Skip to content

Commit

Permalink
keep timings sorted
Browse files Browse the repository at this point in the history
  • Loading branch information
CamillH committed Feb 7, 2024
1 parent ae9ad56 commit 1e8e6f9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
18 changes: 13 additions & 5 deletions Classes/Utility/TimingUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,21 @@ public function shutdown(ScriptResult $result): ?ResponseInterface
}

$timings = [];
foreach ($this->combineIfToMuch($this->order) as $index => $time) {
$duration = $time->getDuration();
$timings[$duration . $index] = $this->timingString($index, trim($time->key . ' ' . $time->info . ' ' . $duration), $duration);
$durations = [];
$stopWatches = $this->combineIfToMuch($this->order);

foreach ($stopWatches as $stopwatch) {
$durations[] = $stopwatch->getDuration();
}

krsort($timings);
$timings = array_slice($timings, 0, $this->configService->getMaxNumberOfTimings());
rsort($durations);

foreach ($stopWatches as $index => $time) {
$duration = $time->getDuration();
if ($duration >= ($durations[$this->configService->getMaxNumberOfTimings() - 1] ?? 0)) {
$timings[] = $this->timingString($index, trim($time->key . ' ' . $time->info . ' ' . $duration), $duration);
}
}


$headerString = implode(',', $timings);
Expand Down
8 changes: 4 additions & 4 deletions ext_conf_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ sentry_sample_rate =
# cat=sentry; type=string; label=Sentry CLI Sample Rate between 0.0 and 1.0 (empty: keep default)
sentry_cli_sample_rate =

# cat=sentry; type=integer; label=Number of timings
number_of_timings =
# cat=sentry; type=integer; label=Number of timings (reduce to make header output smaller. Try out when you get regularly 502 responses).
number_of_timings = 70

# cat=sentry; type=integer; label=Length of description
length_of_description =
# cat=sentry; type=integer; label=Length of description (reduce to make header output smaller. Try out when you get regularly 502 responses).
length_of_description = 100

0 comments on commit 1e8e6f9

Please sign in to comment.