@@ -155,7 +155,7 @@ pub async fn handle_self_profile_processed_download(
155
155
}
156
156
157
157
fn get_self_profile_data (
158
- cpu_clock : Option < f64 > ,
158
+ total_instructions : Option < f64 > ,
159
159
profile : & analyzeme:: AnalysisResults ,
160
160
) -> ServerResult < self_profile:: SelfProfile > {
161
161
let total_time: Duration = profile. query_data . iter ( ) . map ( |qd| qd. self_time ) . sum ( ) ;
@@ -165,22 +165,22 @@ fn get_self_profile_data(
165
165
. iter ( )
166
166
. map ( |qd| self_profile:: QueryData {
167
167
label : qd. label . as_str ( ) . into ( ) ,
168
- self_time : qd. self_time . as_nanos ( ) as u64 ,
168
+ self_instructions : qd. self_time . as_nanos ( ) as u64 ,
169
169
percent_total_time : ( ( qd. self_time . as_secs_f64 ( ) / total_time. as_secs_f64 ( ) ) * 100.0 )
170
170
as f32 ,
171
171
number_of_cache_misses : qd. number_of_cache_misses as u32 ,
172
172
number_of_cache_hits : qd. number_of_cache_hits as u32 ,
173
173
invocation_count : qd. invocation_count as u32 ,
174
- blocked_time : qd. blocked_time . as_nanos ( ) as u64 ,
175
- incremental_load_time : qd. incremental_load_time . as_nanos ( ) as u64 ,
174
+ blocked_instructions : qd. blocked_time . as_nanos ( ) as u64 ,
175
+ incremental_load_instructions : qd. incremental_load_time . as_nanos ( ) as u64 ,
176
176
} )
177
177
. collect ( ) ;
178
178
179
179
let totals = self_profile:: QueryData {
180
180
label : "Totals" . into ( ) ,
181
- self_time : total_time. as_nanos ( ) as u64 ,
181
+ self_instructions : total_time. as_nanos ( ) as u64 ,
182
182
// TODO: check against wall-time from perf stats
183
- percent_total_time : cpu_clock
183
+ percent_total_time : total_instructions
184
184
. map ( |w| ( ( total_time. as_secs_f64 ( ) / w) * 100.0 ) as f32 )
185
185
// sentinel "we couldn't compute this time"
186
186
. unwrap_or ( -100.0 ) ,
@@ -199,12 +199,12 @@ fn get_self_profile_data(
199
199
. iter ( )
200
200
. map ( |qd| qd. invocation_count as u32 )
201
201
. sum ( ) ,
202
- blocked_time : profile
202
+ blocked_instructions : profile
203
203
. query_data
204
204
. iter ( )
205
205
. map ( |qd| qd. blocked_time . as_nanos ( ) as u64 )
206
206
. sum ( ) ,
207
- incremental_load_time : profile
207
+ incremental_load_instructions : profile
208
208
. query_data
209
209
. iter ( )
210
210
. map ( |qd| qd. incremental_load_time . as_nanos ( ) as u64 )
@@ -249,13 +249,13 @@ fn add_uninvoked_base_profile_queries(
249
249
if !profile_queries. contains ( qd. label . as_str ( ) ) {
250
250
let uninvoked_query_data = self_profile:: QueryData {
251
251
label : qd. label ,
252
- self_time : 0 ,
252
+ self_instructions : 0 ,
253
253
percent_total_time : 0.0 ,
254
254
number_of_cache_misses : 0 ,
255
255
number_of_cache_hits : 0 ,
256
256
invocation_count : 0 ,
257
- blocked_time : 0 ,
258
- incremental_load_time : 0 ,
257
+ blocked_instructions : 0 ,
258
+ incremental_load_instructions : 0 ,
259
259
} ;
260
260
261
261
profile. query_data . push ( uninvoked_query_data) ;
@@ -272,11 +272,12 @@ fn get_self_profile_delta(
272
272
let base_profile = base_profile. as_ref ( ) ?;
273
273
274
274
let totals = self_profile:: QueryDataDelta {
275
- self_time : profile. totals . self_time as i64 - base_profile. totals . self_time as i64 ,
275
+ self_time : profile. totals . self_instructions as i64
276
+ - base_profile. totals . self_instructions as i64 ,
276
277
invocation_count : profile. totals . invocation_count as i32
277
278
- base_profile. totals . invocation_count as i32 ,
278
- incremental_load_time : profile. totals . incremental_load_time as i64
279
- - base_profile. totals . incremental_load_time as i64 ,
279
+ incremental_load_time : profile. totals . incremental_load_instructions as i64
280
+ - base_profile. totals . incremental_load_instructions as i64 ,
280
281
} ;
281
282
282
283
let mut query_data = Vec :: new ( ) ;
@@ -289,19 +290,19 @@ fn get_self_profile_delta(
289
290
{
290
291
Some ( base_qd) => {
291
292
let delta = self_profile:: QueryDataDelta {
292
- self_time : qd. self_time as i64 - base_qd. self_time as i64 ,
293
+ self_time : qd. self_instructions as i64 - base_qd. self_instructions as i64 ,
293
294
invocation_count : qd. invocation_count as i32 - base_qd. invocation_count as i32 ,
294
- incremental_load_time : qd. incremental_load_time as i64
295
- - base_qd. incremental_load_time as i64 ,
295
+ incremental_load_time : qd. incremental_load_instructions as i64
296
+ - base_qd. incremental_load_instructions as i64 ,
296
297
} ;
297
298
298
299
query_data. push ( delta) ;
299
300
}
300
301
None => {
301
302
let delta = self_profile:: QueryDataDelta {
302
- self_time : qd. self_time as i64 ,
303
+ self_time : qd. self_instructions as i64 ,
303
304
invocation_count : qd. invocation_count as i32 ,
304
- incremental_load_time : qd. incremental_load_time as i64 ,
305
+ incremental_load_time : qd. incremental_load_instructions as i64 ,
305
306
} ;
306
307
307
308
query_data. push ( delta) ;
@@ -339,12 +340,12 @@ fn sort_self_profile(
339
340
340
341
match sort_idx. abs ( ) {
341
342
1 => indices. sort_by_key ( |& i| qd[ i] . label ) ,
342
- 2 => indices. sort_by_key ( |& i| qd[ i] . self_time ) ,
343
+ 2 => indices. sort_by_key ( |& i| qd[ i] . self_instructions ) ,
343
344
3 => indices. sort_by_key ( |& i| qd[ i] . number_of_cache_misses ) ,
344
345
4 => indices. sort_by_key ( |& i| qd[ i] . number_of_cache_hits ) ,
345
346
5 => indices. sort_by_key ( |& i| qd[ i] . invocation_count ) ,
346
- 6 => indices. sort_by_key ( |& i| qd[ i] . blocked_time ) ,
347
- 7 => indices. sort_by_key ( |& i| qd[ i] . incremental_load_time ) ,
347
+ 6 => indices. sort_by_key ( |& i| qd[ i] . blocked_instructions ) ,
348
+ 7 => indices. sort_by_key ( |& i| qd[ i] . incremental_load_instructions ) ,
348
349
9 => indices. sort_by_key ( |& i| {
349
350
// convert to displayed percentage
350
351
( ( qd[ i] . number_of_cache_hits as f64 / qd[ i] . invocation_count as f64 ) * 10_000.0 ) as u64
@@ -602,9 +603,9 @@ pub async fn handle_self_profile(
602
603
}
603
604
let commits = Arc :: new ( commits) ;
604
605
605
- let mut cpu_responses = ctxt. statistic_series ( query, commits. clone ( ) ) . await ?;
606
- assert_eq ! ( cpu_responses . len( ) , 1 , "all selectors are exact" ) ;
607
- let mut cpu_response = cpu_responses . remove ( 0 ) . series ;
606
+ let mut instructions_responses = ctxt. statistic_series ( query, commits. clone ( ) ) . await ?;
607
+ assert_eq ! ( instructions_responses . len( ) , 1 , "all selectors are exact" ) ;
608
+ let mut instructions_response = instructions_responses . remove ( 0 ) . series ;
608
609
609
610
let mut self_profile_data = Vec :: new ( ) ;
610
611
let conn = ctxt. conn ( ) . await ;
@@ -623,12 +624,16 @@ pub async fn handle_self_profile(
623
624
}
624
625
}
625
626
let profiling_data = self_profile_data. remove ( 0 ) . perform_analysis ( ) ;
626
- let mut profile = get_self_profile_data ( cpu_response. next ( ) . unwrap ( ) . 1 , & profiling_data)
627
- . map_err ( |e| format ! ( "{}: {}" , body. commit, e) ) ?;
627
+ let mut profile =
628
+ get_self_profile_data ( instructions_response. next ( ) . unwrap ( ) . 1 , & profiling_data)
629
+ . map_err ( |e| format ! ( "{}: {}" , body. commit, e) ) ?;
628
630
let ( base_profile, base_raw_data) = if body. base_commit . is_some ( ) {
629
631
let base_profiling_data = self_profile_data. remove ( 0 ) . perform_analysis ( ) ;
630
- let profile = get_self_profile_data ( cpu_response. next ( ) . unwrap ( ) . 1 , & base_profiling_data)
631
- . map_err ( |e| format ! ( "{}: {}" , body. base_commit. as_ref( ) . unwrap( ) , e) ) ?;
632
+ let profile = get_self_profile_data (
633
+ instructions_response. next ( ) . unwrap ( ) . 1 ,
634
+ & base_profiling_data,
635
+ )
636
+ . map_err ( |e| format ! ( "{}: {}" , body. base_commit. as_ref( ) . unwrap( ) , e) ) ?;
632
637
( Some ( profile) , Some ( base_profiling_data) )
633
638
} else {
634
639
( None , None )
0 commit comments