1
1
import { createUrlWithAppendedParams , getUrlParams } from "../utils/navigation" ;
2
2
import { postMsgpack } from "../utils/requests" ;
3
3
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" ;
5
6
6
7
function to_seconds ( time ) {
7
8
return time / 1000000000 ;
@@ -64,6 +65,18 @@ function populate_data(data, state: Selector) {
64
65
let url = processedSelfProfileUrl ( commit , benchmark , scenario , ty ) ;
65
66
return `<a href="${ url } ">${ ty } </a>` ;
66
67
} ;
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 . id === id ) {
75
+ openTraceInPerfetto ( link , traceTitle ) ;
76
+ }
77
+ } ) ;
78
+ return `<a href="#" id="${ id } ">Perfetto</a>` ;
79
+ } ;
67
80
let firefox_profiler_link = ( commit , bench , run ) => {
68
81
let crox_url = encodeURIComponent ( croxTraceUrl ( commit , bench , run ) ) ;
69
82
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) {
84
97
state ,
85
98
"codegen-schedule"
86
99
) }
87
- (${ firefox_profiler_link (
100
+ (${ perfetto_profiler_link (
101
+ "perfetto-before" ,
88
102
state . base_commit ,
89
103
state . benchmark ,
90
104
state . scenario
91
- ) } )
105
+ ) } , ${ firefox_profiler_link (
106
+ state . base_commit ,
107
+ state . benchmark ,
108
+ state . scenario
109
+ ) } )
92
110
results for ${ state . base_commit . substring (
93
111
0 ,
94
112
10
@@ -100,11 +118,16 @@ function populate_data(data, state: Selector) {
100
118
${ processed_link ( state . commit , state , "flamegraph" ) } ,
101
119
${ processed_link ( state . commit , state , "crox" ) } ,
102
120
${ processed_link ( state . commit , state , "codegen-schedule" ) }
103
- (${ firefox_profiler_link (
121
+ (${ perfetto_profiler_link (
122
+ "perfetto-after" ,
104
123
state . commit ,
105
124
state . benchmark ,
106
125
state . scenario
107
- ) } )
126
+ ) } , ${ firefox_profiler_link (
127
+ state . commit ,
128
+ state . benchmark ,
129
+ state . scenario
130
+ ) } )
108
131
results for ${ state . commit . substring ( 0 , 10 ) } (new commit)` ;
109
132
// TODO: use the Cachegrind Vue components once this page is refactored to Vue
110
133
let profile = ( b ) =>
0 commit comments