diff --git a/app/modules/Profiler/Interfaces/Queries/FindFlameChartByUuidHandler.php b/app/modules/Profiler/Interfaces/Queries/FindFlameChartByUuidHandler.php index b4b734c..e95c134 100644 --- a/app/modules/Profiler/Interfaces/Queries/FindFlameChartByUuidHandler.php +++ b/app/modules/Profiler/Interfaces/Queries/FindFlameChartByUuidHandler.php @@ -34,7 +34,8 @@ public function __invoke(FindFlameChartByUuid $query): array $waterfall = []; $eventCache = []; - $metric = 'cpu'; + // TODO: send metric from the frontend side + $metric = 'wt'; foreach ($edges as $edge) { $duration = $edge->getCost()->{$metric} ?? 0; diff --git a/app/modules/Profiler/Interfaces/Queries/FindTopFunctionsByUuidHandler.php b/app/modules/Profiler/Interfaces/Queries/FindTopFunctionsByUuidHandler.php index 2d0863d..21d10fe 100644 --- a/app/modules/Profiler/Interfaces/Queries/FindTopFunctionsByUuidHandler.php +++ b/app/modules/Profiler/Interfaces/Queries/FindTopFunctionsByUuidHandler.php @@ -83,11 +83,11 @@ public function __invoke(FindTopFunctionsByUuid $query): array foreach ($functions as $function => $m) { foreach ($metrics as $metric) { $functions[$function]['p_' . $metric] = \round( - $functions[$function][$metric] / $overallTotals[$metric] * 100, + $functions[$function][$metric] > 0 ? $functions[$function][$metric] / $overallTotals[$metric] * 100 : 0, 3, ); $functions[$function]['p_excl_' . $metric] = \round( - $functions[$function]['excl_' . $metric] / $overallTotals[$metric] * 100, + $functions[$function]['excl_' . $metric] > 0 ? $functions[$function]['excl_' . $metric] / $overallTotals[$metric] * 100 : 0, 3, ); }