aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/argaze/DataFeatures.py14
-rw-r--r--src/argaze/utils/demo/recorders.py21
2 files changed, 20 insertions, 15 deletions
diff --git a/src/argaze/DataFeatures.py b/src/argaze/DataFeatures.py
index 1bb1329..72f1d26 100644
--- a/src/argaze/DataFeatures.py
+++ b/src/argaze/DataFeatures.py
@@ -1312,26 +1312,26 @@ class PipelineStepObject():
def execution_info(self, method_name: str) -> tuple[float, float]:
"""Get pipeline step method execution time (s) and frequency (Hz)."""
- time = math.nan
- frequency = math.nan
+ t = math.nan
+ f = math.nan
# Check execution time
try:
start, end = self._execution_times[method_name]
- time = end - start
+ t = end - start
except KeyError:
- time = math.nan
+ t = math.nan
# Check execution frequency
try:
- frequency = self._execution_frequencies[method_name]
+ f = self._execution_frequencies[method_name]
except KeyError:
- frequency = math.nan
+ f = math.nan
- return time, frequency
+ return t, f
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)