aboutsummaryrefslogtreecommitdiff
path: root/src/argaze/utils/demo/recorders.py
diff options
context:
space:
mode:
authorThéo de la Hogue2024-06-21 08:35:39 +0200
committerThéo de la Hogue2024-06-21 08:35:39 +0200
commit960f2b730bc6fa25b77edba306ddc0f3604bc84b (patch)
treef2048b3a01e3d01410f175aefc0c94a2f6c7f39e /src/argaze/utils/demo/recorders.py
parentea485d5b07af4e275475feaa4cd93eca4eb5af94 (diff)
downloadargaze-960f2b730bc6fa25b77edba306ddc0f3604bc84b.zip
argaze-960f2b730bc6fa25b77edba306ddc0f3604bc84b.tar.gz
argaze-960f2b730bc6fa25b77edba306ddc0f3604bc84b.tar.bz2
argaze-960f2b730bc6fa25b77edba306ddc0f3604bc84b.tar.xz
Renaming variable to avoid confusion.
Diffstat (limited to 'src/argaze/utils/demo/recorders.py')
-rw-r--r--src/argaze/utils/demo/recorders.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/argaze/utils/demo/recorders.py b/src/argaze/utils/demo/recorders.py
index 214c543..63a2fa2 100644
--- a/src/argaze/utils/demo/recorders.py
+++ b/src/argaze/utils/demo/recorders.py
@@ -18,6 +18,7 @@ __copyright__ = "Copyright 2023, Ecole Nationale de l'Aviation Civile (ENAC)"
__license__ = "GPLv3"
import logging
+import time
from argaze import DataFeatures, GazeFeatures
from argaze.utils import UtilsFeatures
@@ -30,17 +31,19 @@ class LookPerformanceRecorder(UtilsFeatures.FileWriter):
self.header = "Timestamp (ms)", "Time (ms)", "Frequency (Hz)"
+ self.__start_time = time.perf_counter()
+
logging.info('%s writes into %s', DataFeatures.get_class_path(self), self.path)
def on_look(self, timestamp, frame, exception):
"""Log frame look execution performance."""
- time, frequency = frame.execution_info('look')
+ t, f = frame.execution_info('look')
log = (
- timestamp,
- time * 1e3,
- frequency
+ (time.perf_counter() - self.__start_time) * 1e3,
+ t * 1e3,
+ f
)
self.write(log)
@@ -53,17 +56,19 @@ class WatchPerformanceRecorder(UtilsFeatures.FileWriter):
self.header = "Timestamp (ms)", "Time (ms)", "Frequency (Hz)"
+ self.__start_time = time.perf_counter()
+
logging.info('%s writes into %s', DataFeatures.get_class_path(self), self.path)
def on_watch(self, timestamp, camera, exception):
"""Log camera watch execution performance."""
- time, frequency = camera.execution_info('watch')
+ t, f = camera.execution_info('watch')
log = (
- timestamp,
- time * 1e3,
- frequency
+ (time.perf_counter() - self.__start_time) * 1e3,
+ t * 1e3,
+ f
)
self.write(log)