diff options
Diffstat (limited to 'src/argaze/utils/demo/recorders.py')
-rw-r--r-- | src/argaze/utils/demo/recorders.py | 21 |
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) |