@@ -93,7 +93,8 @@ impl CategoryData {
93
93
( $name: tt, $rustic_name: ident) => {
94
94
let ( hits, total) = self . query_counts. $rustic_name;
95
95
let ( hits, total) = if total > 0 {
96
- ( format!( "{:.2}" , ( ( ( hits as f32 ) / ( total as f32 ) ) * 100.0 ) ) , total. to_string( ) )
96
+ ( format!( "{:.2}" ,
97
+ ( ( ( hits as f32 ) / ( total as f32 ) ) * 100.0 ) ) , total. to_string( ) )
97
98
} else {
98
99
( "" . into( ) , "" . into( ) )
99
100
} ;
@@ -109,8 +110,10 @@ impl CategoryData {
109
110
} ;
110
111
}
111
112
112
- writeln ! ( lock, "| Phase | Time (ms) | Queries | Hits (%) |" ) . unwrap ( ) ;
113
- writeln ! ( lock, "| ---------------- | -------------- | -------------- | -------- |" ) . unwrap ( ) ;
113
+ writeln ! ( lock, "| Phase | Time (ms) | Queries | Hits (%) |" )
114
+ . unwrap ( ) ;
115
+ writeln ! ( lock, "| ---------------- | -------------- | -------------- | -------- |" )
116
+ . unwrap ( ) ;
114
117
115
118
p ! ( "Parsing" , parsing) ;
116
119
p ! ( "Expansion" , expansion) ;
@@ -126,7 +129,9 @@ impl CategoryData {
126
129
( $category: tt, $rustic_name: ident) => { {
127
130
let ( hits, total) = self . query_counts. $rustic_name;
128
131
129
- format!( "{{ \" category\" : {}, \" time_ms\" : {}, \" query_count\" : {}, \" query_hits\" : {} }}" ,
132
+ format!(
133
+ "{{ \" category\" : {}, \" time_ms\" : {},
134
+ \" query_count\" : {}, \" query_hits\" : {} }}" ,
130
135
stringify!( $category) ,
131
136
self . times. $rustic_name / 1_000_000 ,
132
137
total,
@@ -209,9 +214,9 @@ impl SelfProfiler {
209
214
pub fn end_activity ( & mut self , category : ProfileCategory ) {
210
215
match self . timer_stack . pop ( ) {
211
216
None => bug ! ( "end_activity() was called but there was no running activity" ) ,
212
- Some ( c) =>
217
+ Some ( c) =>
213
218
assert ! (
214
- c == category,
219
+ c == category,
215
220
"end_activity() was called but a different activity was running" ) ,
216
221
}
217
222
@@ -223,7 +228,8 @@ impl SelfProfiler {
223
228
}
224
229
}
225
230
226
- //the new timer is different than the previous, so record the elapsed time and start a new timer
231
+ //the new timer is different than the previous,
232
+ //so record the elapsed time and start a new timer
227
233
let elapsed = self . stop_timer ( ) ;
228
234
let new_time = self . data . times . get ( category) + elapsed;
229
235
self . data . times . set ( category, new_time) ;
@@ -240,12 +246,18 @@ impl SelfProfiler {
240
246
pub fn print_results ( & mut self , opts : & Options ) {
241
247
self . end_activity ( ProfileCategory :: Other ) ;
242
248
243
- assert ! ( self . timer_stack. is_empty( ) , "there were timers running when print_results() was called" ) ;
249
+ assert ! (
250
+ self . timer_stack. is_empty( ) ,
251
+ "there were timers running when print_results() was called" ) ;
244
252
245
253
let out = io:: stdout ( ) ;
246
254
let mut lock = out. lock ( ) ;
247
255
248
- let crate_name = opts. crate_name . as_ref ( ) . map ( |n| format ! ( " for {}" , n) ) . unwrap_or_default ( ) ;
256
+ let crate_name =
257
+ opts. crate_name
258
+ . as_ref ( )
259
+ . map ( |n| format ! ( " for {}" , n) )
260
+ . unwrap_or_default ( ) ;
249
261
250
262
writeln ! ( lock, "Self profiling results{}:" , crate_name) . unwrap ( ) ;
251
263
writeln ! ( lock) . unwrap ( ) ;
@@ -261,9 +273,10 @@ impl SelfProfiler {
261
273
262
274
pub fn save_results ( & self , opts : & Options ) {
263
275
let category_data = self . data . json ( ) ;
264
- let compilation_options = format ! ( "{{ \" optimization_level\" : \" {:?}\" , \" incremental\" : {} }}" ,
265
- opts. optimize,
266
- if opts. incremental. is_some( ) { "true" } else { "false" } ) ;
276
+ let compilation_options =
277
+ format ! ( "{{ \" optimization_level\" : \" {:?}\" , \" incremental\" : {} }}" ,
278
+ opts. optimize,
279
+ if opts. incremental. is_some( ) { "true" } else { "false" } ) ;
267
280
268
281
let json = format ! ( "{{ \" category_data\" : {}, \" compilation_options\" : {} }}" ,
269
282
category_data,
0 commit comments