@@ -58,7 +58,7 @@ impl AnalysisStatsCmd {
58
58
let mut db_load_sw = self . stop_watch ( ) ;
59
59
let ( host, vfs) = load_cargo ( & self . path , self . load_output_dirs , self . with_proc_macro ) ?;
60
60
let db = host. raw_database ( ) ;
61
- eprintln ! ( "Database loaded {} " , db_load_sw. elapsed( ) ) ;
61
+ eprintln ! ( "{:<20} {}" , "Database loaded: ", db_load_sw. elapsed( ) ) ;
62
62
63
63
let mut analysis_sw = self . stop_watch ( ) ;
64
64
let mut num_crates = 0 ;
@@ -85,7 +85,7 @@ impl AnalysisStatsCmd {
85
85
shuffle ( & mut rng, & mut visit_queue) ;
86
86
}
87
87
88
- eprintln ! ( "Crates in this dir : {}" , num_crates) ;
88
+ eprint ! ( " crates : {}" , num_crates) ;
89
89
let mut num_decls = 0 ;
90
90
let mut funcs = Vec :: new ( ) ;
91
91
while let Some ( module) = visit_queue. pop ( ) {
@@ -109,10 +109,8 @@ impl AnalysisStatsCmd {
109
109
}
110
110
}
111
111
}
112
- eprintln ! ( "Total modules found: {}" , visited_modules. len( ) ) ;
113
- eprintln ! ( "Total declarations: {}" , num_decls) ;
114
- eprintln ! ( "Total functions: {}" , funcs. len( ) ) ;
115
- eprintln ! ( "Item Collection: {}" , analysis_sw. elapsed( ) ) ;
112
+ eprintln ! ( ", mods: {}, decls: {}, fns: {}" , visited_modules. len( ) , num_decls, funcs. len( ) ) ;
113
+ eprintln ! ( "{:<20} {}" , "Item Collection:" , analysis_sw. elapsed( ) ) ;
116
114
117
115
if self . randomize {
118
116
shuffle ( & mut rng, & mut funcs) ;
@@ -135,7 +133,7 @@ impl AnalysisStatsCmd {
135
133
snap. 0 . infer ( f_id. into ( ) ) ;
136
134
} )
137
135
. count ( ) ;
138
- eprintln ! ( "Parallel Inference: {}" , inference_sw. elapsed( ) ) ;
136
+ eprintln ! ( "{:<20} {}" , "Parallel Inference: ", inference_sw. elapsed( ) ) ;
139
137
}
140
138
141
139
let mut inference_sw = self . stop_watch ( ) ;
@@ -273,27 +271,22 @@ impl AnalysisStatsCmd {
273
271
bar. inc ( 1 ) ;
274
272
}
275
273
bar. finish_and_clear ( ) ;
276
- eprintln ! ( "Total expressions: {}" , num_exprs) ;
277
274
eprintln ! (
278
- "Expressions of unknown type: {} ({}%)" ,
275
+ " exprs: {}, ??ty: {} ({}%), ?ty: {} ({}%), !ty: {}" ,
276
+ num_exprs,
279
277
num_exprs_unknown,
280
- if num_exprs > 0 { num_exprs_unknown * 100 / num_exprs } else { 100 }
281
- ) ;
282
- report_metric ( "unknown type" , num_exprs_unknown, "#" ) ;
283
-
284
- eprintln ! (
285
- "Expressions of partially unknown type: {} ({}%)" ,
278
+ percentage( num_exprs_unknown, num_exprs) ,
286
279
num_exprs_partially_unknown,
287
- if num_exprs > 0 { num_exprs_partially_unknown * 100 / num_exprs } else { 100 }
280
+ percentage( num_exprs_partially_unknown, num_exprs) ,
281
+ num_type_mismatches
288
282
) ;
289
-
290
- eprintln ! ( "Type mismatches: {}" , num_type_mismatches) ;
283
+ report_metric ( "unknown type" , num_exprs_unknown, "#" ) ;
291
284
report_metric ( "type mismatches" , num_type_mismatches, "#" ) ;
292
285
293
- eprintln ! ( "Inference: {}" , inference_sw. elapsed( ) ) ;
286
+ eprintln ! ( "{:<20} {}" , "Inference: ", inference_sw. elapsed( ) ) ;
294
287
295
288
let total_span = analysis_sw. elapsed ( ) ;
296
- eprintln ! ( "Total: {}" , total_span) ;
289
+ eprintln ! ( "{:<20} {}" , "Total: ", total_span) ;
297
290
report_metric ( "total time" , total_span. time . as_millis ( ) as u64 , "ms" ) ;
298
291
if let Some ( instructions) = total_span. instructions {
299
292
report_metric ( "total instructions" , instructions, "#instr" ) ;
@@ -325,3 +318,7 @@ fn shuffle<T>(rng: &mut Rand32, slice: &mut [T]) {
325
318
slice. swap ( 0 , idx) ;
326
319
}
327
320
}
321
+
322
+ fn percentage ( n : u64 , total : u64 ) -> u64 {
323
+ ( n * 100 ) . checked_div ( total) . unwrap_or ( 100 )
324
+ }
0 commit comments