Skip to content

Commit

Permalink
chore(style): fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed Jul 6, 2024
1 parent 5331890 commit 51cf8c2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Module/Frontend/Module/Profiler/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function profilerCallGraph(
string $uuid,
#[QueryParam] float $threshold = 1,
#[QueryParam] float $percentage = 15,
#[QueryParam] string $metric = 'wt'
#[QueryParam] string $metric = 'wt',
): Message\CallGraph {
$event = $this->eventsStorage->get($uuid) ?? throw new \RuntimeException('Event not found.');

Check warning on line 64 in src/Module/Frontend/Module/Profiler/ApiController.php

View check run for this annotation

Codecov / codecov/patch

src/Module/Frontend/Module/Profiler/ApiController.php#L64

Added line #L64 was not covered by tests

Expand Down
2 changes: 1 addition & 1 deletion src/Module/Frontend/Module/Profiler/Mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function topFunctions(Event $event, string $metric): TopFunctions
'mu' => static fn(Branch $a, Branch $b): int => $b->item->cost->mu <=> $a->item->cost->mu,
'pmu' => static fn(Branch $a, Branch $b): int => $b->item->cost->pmu <=> $a->item->cost->pmu,
default => static fn(Branch $a, Branch $b): int => $b->item->cost->wt <=> $a->item->cost->wt,
}
},

Check warning on line 51 in src/Module/Frontend/Module/Profiler/Mapper.php

View check run for this annotation

Codecov / codecov/patch

src/Module/Frontend/Module/Profiler/Mapper.php#L42-L51

Added lines #L42 - L51 were not covered by tests
);

foreach ($topBranches as $branch) {
Expand Down
11 changes: 6 additions & 5 deletions tests/Unit/Module/Profiler/Struct/TreeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ public function testTop(int $top): void
static fn(Edge $edge) => $edge->caller,
);

$result = $tree->top($top, static fn(Branch $a,Branch $b) => $b->item->cost->wt <=> $a->item->cost->wt);
$result = $tree->top($top, static fn(Branch $a, Branch $b) => $b->item->cost->wt <=> $a->item->cost->wt);

self::assertCount(\min($top, \count($edges)), $result);

$topUnoptimized = \array_map(static fn (Edge $e) => $e->cost->wt, $edges);
$topUnoptimized = \array_map(static fn(Edge $e) => $e->cost->wt, $edges);
\rsort($topUnoptimized);
$topUnoptimized = \array_slice($topUnoptimized, 0, $top);
$topVals = \array_map(static fn (Branch $b) => $b->item->cost->wt, $result);
$topVals = \array_map(static fn(Branch $b) => $b->item->cost->wt, $result);
self::assertSame($topUnoptimized, $topVals);
}

Expand All @@ -53,9 +53,10 @@ private function generateEdges(int $multiplier = 20): array
for ($i = 0; $i < $multiplier; $i++) {
for ($j = 0; $j <= $i; $j++) {
$result[] = new Edge(
$i === 0 ? null : 'item-' . ($i - 1) . "-$j", "item-$i-$j",
$i === 0 ? null : 'item-' . ($i - 1) . "-$j",
"item-$i-$j",
new Cost(
ct: (int) $i**$i,
ct: (int) $i ** $i,
wt: ($multiplier - $i) * 1000 + $j,
cpu: ($multiplier - $i) * 10,
mu: (int) $i * 1000,
Expand Down

0 comments on commit 51cf8c2

Please sign in to comment.