Skip to content

Commit

Permalink
Adds schema for profiler top functions table and call-graph toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
butschster committed Jun 9, 2024
1 parent 4332708 commit ef98a3f
Show file tree
Hide file tree
Showing 3 changed files with 185 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/modules/Profiler/Application/Handlers/PrepareEdges.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function handle(array $event): array

foreach (['cpu', 'mu', 'pmu', 'wt'] as $key) {
$values['p_' . $key] = \round(
($values[$key]) / $event['peaks'][$key] * 100,
$values[$key] > 0 ? ($values[$key]) / $event['peaks'][$key] * 100 : 0,
3,
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,28 @@ static function (array $carry, Edge $edge) use (&$registered, $query): array {
return $carry;
},
[
'toolbar' => [
[
'label' => 'CPU',
'metric' => 'cpu',
'description' => 'CPU time in ms.',
],
[
'label' => 'Wall time',
'metric' => 'wt',
'description' => 'Wall time in ms.',
],
[
'label' => 'Memory',
'metric' => 'mu',
'description' => 'Memory usage in bytes.',
],
[
'label' => 'Memory peak',
'metric' => 'pmu',
'description' => 'Memory peak usage in bytes.',
],
],
'nodes' => [],
'edges' => [],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,168 @@ public function __invoke(FindTopFunctionsByUuid $query): array
}

return [
'schema' => [
[
'key' => 'function',
'label' => 'Function',
'description' => 'Function that was called',
'sortable' => false,
'values' => [
[
'key' => 'function',
'format' => 'string',
],
],
],
[
'key' => 'ct',
'label' => 'CT',
'description' => 'Calls',
'sortable' => true,
'values' => [
[
'key' => 'ct',
'format' => 'number',
],
],
],
[
'key' => 'cpu',
'label' => 'CPU',
'description' => 'CPU Time (ms)',
'sortable' => true,
'values' => [
[
'key' => 'cpu',
'format' => 'ms',
],
[
'key' => 'p_cpu',
'format' => 'percent',
'type' => 'sub',
],
],
],
[
'key' => 'excl_cpu',
'label' => 'CPU excl.',
'description' => 'CPU Time exclusions (ms)',
'sortable' => true,
'values' => [
[
'key' => 'excl_cpu',
'format' => 'ms',
],
[
'key' => 'p_excl_cpu',
'format' => 'percent',
'type' => 'sub',
],
],
],
[
'key' => 'wt',
'label' => 'WT',
'description' => 'Wall Time (ms)',
'sortable' => true,
'values' => [
[
'key' => 'wt',
'format' => 'ms',
],
[
'key' => 'p_wt',
'format' => 'percent',
'type' => 'sub',
],
],
],
[
'key' => 'excl_wt',
'label' => 'WT excl.',
'description' => 'Wall Time exclusions (ms)',
'sortable' => true,
'values' => [
[
'key' => 'excl_wt',
'format' => 'ms',
],
[
'key' => 'p_excl_wt',
'format' => 'percent',
'type' => 'sub',
],
],
],
[
'key' => 'mu',
'label' => 'MU',
'description' => 'Memory Usage (bytes)',
'sortable' => true,
'values' => [
[
'key' => 'mu',
'format' => 'bytes',
],
[
'key' => 'p_mu',
'format' => 'percent',
'type' => 'sub',
],
],
],
[
'key' => 'excl_mu',
'label' => 'MU excl.',
'description' => 'Memory Usage exclusions (bytes)',
'sortable' => true,
'values' => [
[
'key' => 'excl_mu',
'format' => 'bytes',
],
[
'key' => 'p_excl_mu',
'format' => 'percent',
'type' => 'sub',
],
],
],
[
'key' => 'pmu',
'label' => 'PMU',
'description' => 'Peak Memory Usage (bytes)',
'sortable' => true,
'values' => [
[
'key' => 'pmu',
'format' => 'bytes',
],
[
'key' => 'p_pmu',
'format' => 'percent',
'type' => 'sub',
],
],
],
[
'key' => 'excl_pmu',
'label' => 'PMU excl.',
'description' => 'Peak Memory Usage exclusions (bytes)',
'sortable' => true,
'values' => [
[
'key' => 'excl_pmu',
'format' => 'bytes',
],
[
'key' => 'p_excl_pmu',
'format' => 'percent',
'type' => 'sub',
],
],
],
],
'overall_totals' => $overallTotals,
'functions' => $functions,
];
Expand Down

0 comments on commit ef98a3f

Please sign in to comment.