@@ -286,7 +286,8 @@ pub struct TestOpts {
286
286
pub logfile : Option < Path > ,
287
287
pub nocapture : bool ,
288
288
pub color : ColorConfig ,
289
- pub show_error_bar : bool ,
289
+ pub show_boxplot : bool ,
290
+ pub boxplot_width : uint ,
290
291
pub show_all_stats : bool ,
291
292
}
292
293
@@ -305,7 +306,8 @@ impl TestOpts {
305
306
logfile : None ,
306
307
nocapture : false ,
307
308
color : AutoColor ,
308
- show_error_bar : false ,
309
+ show_boxplot : false ,
310
+ boxplot_width : 50 ,
309
311
show_all_stats : false ,
310
312
}
311
313
}
@@ -338,7 +340,8 @@ fn optgroups() -> Vec<getopts::OptGroup> {
338
340
auto = colorize if stdout is a tty and tests are run on serially (default);
339
341
always = always colorize output;
340
342
never = never colorize output;" , "auto|always|never" ) ,
341
- getopts:: optflag( "" , "error-bar" , "Display error bars for the benchmarks" ) ,
343
+ getopts:: optflag( "" , "boxplot" , "Display a boxplot of the benchmark statistics" ) ,
344
+ getopts:: optopt( "" , "boxplot-width" , "Set the boxplot width (default 50)" , "WIDTH" ) ,
342
345
getopts:: optflag( "" , "stats" , "Display the benchmark min, max, and quartiles" ) )
343
346
}
344
347
@@ -430,7 +433,19 @@ pub fn parse_opts(args: &[String]) -> Option<OptRes> {
430
433
v) ) ) ,
431
434
} ;
432
435
433
- let show_error_bar = matches. opt_present ( "error-bar" ) ;
436
+ let show_boxplot = matches. opt_present ( "boxplot" ) ;
437
+ let boxplot_width = match matches. opt_str ( "boxplot-width" ) {
438
+ Some ( width) => {
439
+ match FromStr :: from_str ( width. as_slice ( ) ) {
440
+ Some ( width) => width,
441
+ None => {
442
+ return Some ( Err ( format ! ( "argument for --boxplot-width must be a uint" ) ) ) ;
443
+ }
444
+ }
445
+ }
446
+ None => 50 ,
447
+ } ;
448
+
434
449
let show_all_stats = matches. opt_present ( "stats" ) ;
435
450
436
451
let test_opts = TestOpts {
@@ -445,7 +460,8 @@ pub fn parse_opts(args: &[String]) -> Option<OptRes> {
445
460
logfile : logfile,
446
461
nocapture : nocapture,
447
462
color : color,
448
- show_error_bar : show_error_bar,
463
+ show_boxplot : show_boxplot,
464
+ boxplot_width : boxplot_width,
449
465
show_all_stats : show_all_stats,
450
466
} ;
451
467
@@ -497,7 +513,8 @@ struct ConsoleTestState<T> {
497
513
log_out : Option < File > ,
498
514
out : OutputLocation < T > ,
499
515
use_color : bool ,
500
- show_error_bar : bool ,
516
+ show_boxplot : bool ,
517
+ boxplot_width : uint ,
501
518
show_all_stats : bool ,
502
519
total : uint ,
503
520
passed : uint ,
@@ -525,7 +542,8 @@ impl<T: Writer> ConsoleTestState<T> {
525
542
out : out,
526
543
log_out : log_out,
527
544
use_color : use_color ( opts) ,
528
- show_error_bar : opts. show_error_bar ,
545
+ show_boxplot : opts. show_boxplot ,
546
+ boxplot_width : opts. boxplot_width ,
529
547
show_all_stats : opts. show_all_stats ,
530
548
total : 0 u,
531
549
passed : 0 u,
@@ -623,10 +641,10 @@ impl<T: Writer> ConsoleTestState<T> {
623
641
TrBench ( ref bs) => {
624
642
try!( self . write_bench ( ) ) ;
625
643
626
- if self . show_error_bar {
644
+ if self . show_boxplot {
627
645
let mut wr = Vec :: new ( ) ;
628
646
629
- try!( stats:: write_boxplot ( & mut wr, & bs. ns_iter_summ , 50 ) ) ;
647
+ try!( stats:: write_boxplot ( & mut wr, & bs. ns_iter_summ , self . boxplot_width ) ) ;
630
648
631
649
let s = String :: from_utf8 ( wr) . unwrap ( ) ;
632
650
0 commit comments