From 07260c4f9335e15579fd5a2926cf37a58c5c7f05 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Tue, 23 Jul 2024 16:12:51 +0200 Subject: Fixing execution frequency calculation. --- src/argaze/DataFeatures.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/argaze/DataFeatures.py b/src/argaze/DataFeatures.py index 6711905..491d6ac 100644 --- a/src/argaze/DataFeatures.py +++ b/src/argaze/DataFeatures.py @@ -703,24 +703,21 @@ def PipelineStepExecutionTime(method): end = time.perf_counter() - # Create list to store method call dates + # Create list to store method call dates and init call frequency if method.__name__ not in self._execution_times.keys(): self._execution_times[method.__name__] = [] + self._execution_frequencies[method.__name__] = math.nan # Store start end end dates self._execution_times[method.__name__].append((start, end)) # Remove call dates older than 1 second and count number of calls to get frequency - if self._execution_times[method.__name__][-1][0] - self._execution_times[method.__name__][0][0] > 1: + while self._execution_times[method.__name__][-1][0] - self._execution_times[method.__name__][0][0] > 1: self._execution_times[method.__name__].pop(0) self._execution_frequencies[method.__name__] = len(self._execution_times[method.__name__]) - else: - - self._execution_frequencies[method.__name__] = math.nan - return result return wrapper -- cgit v1.1