Skip to content

Commit

Permalink
Perf.Measurements.Results: fix warmup/warmdown calculation
Browse files Browse the repository at this point in the history
This index based calculation is inaccurate if the data structure doesn't
reflect a single very specific usecase... instead we can simply
calculate the timestamps by addition...

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
  • Loading branch information
olichtne committed Oct 3, 2024
1 parent ef13708 commit 8e924a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,33 +84,11 @@ def end_timestamp(self):

@property
def warmup_end(self):
if self.warmup_duration == 0:
return self.start_timestamp

return max(
[
parallel[self.warmup_duration - 1].end_timestamp
for parallel in (
*self.generator_results,
*self.receiver_results,
)
]
)
return self.start_timestamp+self.warmup_duration

@property
def warmdown_start(self):
if self.warmup_duration == 0:
return self.end_timestamp

return min(
[
parallel[-self.warmup_duration].start_timestamp
for parallel in (
*self.generator_results,
*self.receiver_results,
)
]
)
return self.end_timestamp-self.warmup_duration

def time_slice(self, start, end):
result_copy = FlowMeasurementResults(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def warmup_end(self):

return max(
[
parallel[self.warmup_duration - 1].end_timestamp
parallel.start_timestamp + self.warmup_duration
for parallel in self.generator_results
]
)
Expand All @@ -27,7 +27,7 @@ def warmdown_start(self):

return min(
[
parallel[-self.warmup_duration].start_timestamp
parallel.start_timestamp - self.warmup_duration
for parallel in self.generator_results
]
)

0 comments on commit 8e924a8

Please sign in to comment.