summaryrefslogtreecommitdiff
path: root/simpleperf
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2024-01-23 13:57:53 -0800
committerYabin Cui <yabinc@google.com>2024-01-23 13:57:53 -0800
commitf0b3448a10e9c237dc343ebec53942fe88f9badd (patch)
tree45c0c00dc2ffb5df9c0bd56dd1446a99fbf136d4 /simpleperf
parentb0bb4d345b84141954d8f6e92603891a030ce70c (diff)
downloadextras-f0b3448a10e9c237dc343ebec53942fe88f9badd.tar.gz
simpleperf: report_html.py: Sort functions in Function flamegraphs
Bug: 306433890 Test: run report_html.py Test: run test.py --only-host-test Change-Id: Ibf3a4a56949e9ed202af8c16069a4313d536b51d
Diffstat (limited to 'simpleperf')
-rw-r--r--simpleperf/scripts/report_html.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/simpleperf/scripts/report_html.js b/simpleperf/scripts/report_html.js
index b0827f40..8203dd36 100644
--- a/simpleperf/scripts/report_html.js
+++ b/simpleperf/scripts/report_html.js
@@ -1215,18 +1215,21 @@ class FlameGraphView {
let map = new Map();
for (let node of nodes) {
for (let child of node.c) {
- let subNodes = map.get(child.f);
+ let funcName = getFuncName(child.f);
+ let subNodes = map.get(funcName);
if (subNodes) {
subNodes.push(child);
} else {
- map.set(child.f, [child]);
+ map.set(funcName, [child]);
}
}
}
+ const funcNames = [...map.keys()].sort();
let res = [];
- for (let subNodes of map.values()) {
+ funcNames.forEach(function (funcName) {
+ const subNodes = map.get(funcName);
res.push(subNodes.length == 1 ? subNodes[0] : subNodes);
- }
+ });
return res;
}