diff options
author | Théo de la Hogue | 2024-07-23 12:35:51 +0200 |
---|---|---|
committer | Théo de la Hogue | 2024-07-23 12:35:51 +0200 |
commit | e48fd3077858171301f5a81b4881f8d6b489c85d (patch) | |
tree | 32ed5430523026eee71a63101c3017762ce1ae88 /src | |
parent | ed215e841a41735e483abbcbc6f6e9a4c5cafb77 (diff) | |
download | argaze-e48fd3077858171301f5a81b4881f8d6b489c85d.zip argaze-e48fd3077858171301f5a81b4881f8d6b489c85d.tar.gz argaze-e48fd3077858171301f5a81b4881f8d6b489c85d.tar.bz2 argaze-e48fd3077858171301f5a81b4881f8d6b489c85d.tar.xz |
Improving execution info calculation.
Diffstat (limited to 'src')
-rw-r--r-- | src/argaze/DataFeatures.py | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/argaze/DataFeatures.py b/src/argaze/DataFeatures.py index 2629e8e..6711905 100644 --- a/src/argaze/DataFeatures.py +++ b/src/argaze/DataFeatures.py @@ -703,21 +703,23 @@ def PipelineStepExecutionTime(method): end = time.perf_counter() - # Check earlier call dates to calculate frequency - try: + # Create list to store method call dates + if method.__name__ not in self._execution_times.keys(): - last_start, last_end = self._execution_times[method.__name__] + self._execution_times[method.__name__] = [] - if start > last_start: + # Store start end end dates + self._execution_times[method.__name__].append((start, end)) - self._execution_frequencies[method.__name__] = 1 / (start - last_start) - - except KeyError: + # 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: - self._execution_frequencies[method.__name__] = math.nan + self._execution_times[method.__name__].pop(0) + self._execution_frequencies[method.__name__] = len(self._execution_times[method.__name__]) - # Store start end end dates - self._execution_times[method.__name__] = (start, end) + else: + + self._execution_frequencies[method.__name__] = math.nan return result @@ -1354,8 +1356,7 @@ class PipelineStepObject(): # Check execution time try: - start, end = self._execution_times[method_name] - t = end - start + t = numpy.mean(numpy.diff(self._execution_times[method_name])) except KeyError: |