Skip to content

Commit ac3d9d9

Browse files
committed
Add Perfetto link to detailed query page
1 parent 1428f44 commit ac3d9d9

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

site/frontend/src/pages/detailed-query.ts

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import {createUrlWithAppendedParams, getUrlParams} from "../utils/navigation";
22
import {postMsgpack} from "../utils/requests";
33
import {SELF_PROFILE_DATA_URL} from "../urls";
4-
import {processedSelfProfileUrl} from "../self-profile";
4+
import {croxTraceUrl, processedSelfProfileUrl} from "../self-profile";
5+
import {openTraceInPerfetto} from "../perfetto";
56

67
function to_seconds(time) {
78
return time / 1000000000;
@@ -64,6 +65,18 @@ function populate_data(data, state: Selector) {
6465
let url = processedSelfProfileUrl(commit, benchmark, scenario, ty);
6566
return `<a href="${url}">${ty}</a>`;
6667
};
68+
// FIXME: remove this hack and use the PerfettoLink component once this page is
69+
// converted to Vue.
70+
let perfetto_profiler_link = (id, commit, bench, run) => {
71+
let link = croxTraceUrl(commit, bench, run);
72+
let traceTitle = `${bench}-${run} (${commit})`;
73+
document.addEventListener("click", (event) => {
74+
if ((event.target as HTMLElement).id === id) {
75+
openTraceInPerfetto(link, traceTitle);
76+
}
77+
});
78+
return `<a href="#" id="${id}">Perfetto</a>`;
79+
};
6780
let firefox_profiler_link = (commit, bench, run) => {
6881
let crox_url = encodeURIComponent(croxTraceUrl(commit, bench, run));
6982
let ff_url = `https://profiler.firefox.com/from-url/${crox_url}/marker-chart/?v=5`;
@@ -84,11 +97,16 @@ function populate_data(data, state: Selector) {
8497
state,
8598
"codegen-schedule"
8699
)}
87-
(${firefox_profiler_link(
100+
(${perfetto_profiler_link(
101+
"perfetto-before",
88102
state.base_commit,
89103
state.benchmark,
90104
state.scenario
91-
)})
105+
)}, ${firefox_profiler_link(
106+
state.base_commit,
107+
state.benchmark,
108+
state.scenario
109+
)})
92110
results for ${state.base_commit.substring(
93111
0,
94112
10
@@ -100,11 +118,16 @@ function populate_data(data, state: Selector) {
100118
${processed_link(state.commit, state, "flamegraph")},
101119
${processed_link(state.commit, state, "crox")},
102120
${processed_link(state.commit, state, "codegen-schedule")}
103-
(${firefox_profiler_link(
121+
(${perfetto_profiler_link(
122+
"perfetto-after",
104123
state.commit,
105124
state.benchmark,
106125
state.scenario
107-
)})
126+
)}, ${firefox_profiler_link(
127+
state.commit,
128+
state.benchmark,
129+
state.scenario
130+
)})
108131
results for ${state.commit.substring(0, 10)} (new commit)`;
109132
// TODO: use the Cachegrind Vue components once this page is refactored to Vue
110133
let profile = (b) =>

0 commit comments

Comments
 (0)