Added total camera fps, total processed fps, and total skipped fps to stats api (#19469)

Co-authored-by: Mark Francis <markfrancisonly@gmail.com>
This commit is contained in:
markfrancisonly
2025-08-16 10:20:33 -05:00
committed by Blake Blackshear
co-authored by Mark Francis
parent cc18d7f786
commit 8e663413bb
5 changed files with 18 additions and 13 deletions
+7 -1
View File
@@ -268,10 +268,13 @@ def stats_snapshot(
camera_metrics = stats_tracking["camera_metrics"]
stats: dict[str, Any] = {}
total_detection_fps = 0
total_camera_fps = total_process_fps = total_skipped_fps = total_detection_fps = 0
stats["cameras"] = {}
for name, camera_stats in camera_metrics.items():
total_camera_fps += camera_stats.camera_fps.value
total_process_fps += camera_stats.process_fps.value
total_skipped_fps += camera_stats.skipped_fps.value
total_detection_fps += camera_stats.detection_fps.value
pid = camera_stats.process_pid.value if camera_stats.process_pid.value else None
ffmpeg_pid = camera_stats.ffmpeg_pid.value if camera_stats.ffmpeg_pid else None
@@ -305,6 +308,9 @@ def stats_snapshot(
# from mypy 0.981 onwards
"pid": pid,
}
stats["camera_fps"] = round(total_camera_fps, 2)
stats["process_fps"] = round(total_process_fps, 2)
stats["skipped_fps"] = round(total_skipped_fps, 2)
stats["detection_fps"] = round(total_detection_fps, 2)
stats["embeddings"] = {}
+3
View File
@@ -45,6 +45,9 @@ class BaseTestHttp(unittest.TestCase):
},
}
self.test_stats = {
"camera_fps": 5.0,
"process_fps": 5.0,
"skipped_fps": 0.0,
"detection_fps": 13.7,
"detectors": {
"cpu1": {
+3
View File
@@ -49,6 +49,9 @@ class TestHttp(unittest.TestCase):
},
}
self.test_stats = {
"camera_fps": 5.0,
"process_fps": 5.0,
"skipped_fps": 0.0,
"detection_fps": 13.7,
"detectors": {
"cpu1": {