Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use non-aggregated data when generating the flamegraph. #219

Merged
merged 2 commits into from
Nov 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Xhgui/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,11 @@ protected function _callgraphData($parentName, $main, $metric, $threshold, $pare
/**
* Return a structured array suitable for generating flamegraph visualizations.
*
* Functions whose inclusive time is less than 1% of the total time will
* Functions whose inclusive time is less than $threshold of the total time will
* be excluded from the callgraph data.
*
* @param string $metric The metric name to aggregate on.
* @param float $threshold The total % below which data should be elided.
* @return array
*/
public function getFlamegraph($metric = 'wt', $threshold = 0.01)
Expand Down Expand Up @@ -612,7 +614,6 @@ protected function _flamegraphData($parentName, $main, $metric, $threshold, $par

$children = $this->_indexed[$parentName];
foreach ($children as $childName => $metrics) {
$metrics = $this->_collapsed[$childName];
if ($metrics[$metric] / $main <= $threshold) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/templates/runs/flamegraph.twig
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ d3.json("{{ url('run.flamegraph.data', {id: profile.id|trim }) }}", function(err
$(document).ready(function(){
$("form").submit(function(event){
event.preventDefault();
search();
flameGraph.search($('#term').val());
});
});

Expand Down
4 changes: 2 additions & 2 deletions tests/ProfileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ public function testGetFlamegraphNonUniqueLeaf()
'children' => array(
array(
'name' => 'util()',
'value' => 5000,
'value' => 1500,
'children' => array(
array(
'name' => 'util_helper()',
Expand All @@ -582,7 +582,7 @@ public function testGetFlamegraphNonUniqueLeaf()
'children' => array(
array(
'name' => 'util()',
'value' => 5000
'value' => 3500
),
),
),
Expand Down