Skip to content
Myr

Rename --setup to --prepare

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by sharkdp · committed by sharkdp · parent d5e02ff · Browse files · 4 files+39 added−30 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+39 added−30 removed

  • other:+39 added−30 removed

4 files+39 added−30 removed

modified:src/hyperfine/benchmark.rs+6 added-6 removed
131 unmodified lines
132133 // Set up progress bar (and spinner for initial measurement)134 let bar = get_progress_bar(options.min_runs, "Initial time measurement");135136 // Run setup / cleanup command137 let run_setup_command = || {138 if let Some(ref setup_command) = options.setup_command {139 let _ = time_shell_command(setup_command, options.ignore_failure, None);136 // Run init / cleanup command137 let run_preparation_command = || {138 if let Some(ref preparation_command) = options.preparation_command {139 let _ = time_shell_command(preparation_command, options.ignore_failure, None);140 }141 };142 run_setup_command();142 run_preparation_command();143144 // Initial timing run145 let res = time_shell_command(cmd, options.ignore_failure, Some(shell_spawning_time))?;146
17 unmodified lines
164 bar.set_length(count_remaining);165166 // Gather statistics167 for _ in 0..count_remaining {168 run_setup_command();168 run_preparation_command();169170 let msg = {171 let mean = format_duration(mean(&execution_times), Unit::Auto);172 format!("Current estimate: {}", Green.paint(mean))
65 unmodified lines
modified:src/hyperfine/internal.rs+3 added-3 removed
20 unmodified lines
2122 /// Whether or not to ignore non-zero exit codes23 pub ignore_failure: bool,2425 /// Command to run before each benchmark run26 pub setup_command: Option<String>,25 /// Command to run before each timing run26 pub preparation_command: Option<String>,27}2829impl Default for HyperfineOptions {30 fn default() -> HyperfineOptions {
1 unmodified line
32 warmup_count: 0,33 min_runs: 10,34 min_time_sec: 3.0,35 ignore_failure: false,36 setup_command: None,36 preparation_command: None,37 }38 }39}40
48 unmodified lines
modified:src/main.rs+13 added-13 removed
51 unmodified lines
52 .multiple(true)53 .empty_values(false),54 )55 .arg(56 Arg::with_name("ignore-failure")57 .long("ignore-failure")58 .short("i")59 .help("Ignore non-zero exit codes"),60 )61 .arg(56 Arg::with_name("warmup")57 .long("warmup")58 .short("w")59 .takes_value(true)
14 unmodified lines
74 options.min_runs75 )),76 )77 .arg(84 Arg::with_name("setup")85 .long("setup")86 .short("S")78 Arg::with_name("prepare")79 .long("prepare")80 .short("p")81 .takes_value(true)82 .value_name("CMD")83 .help(90 "Execute CMD before each benchmark run. This is useful for \84 "Execute CMD before each timing run. This is useful for \85 clearing disk caches, for example",86 ),87 )88 .arg(89 Arg::with_name("ignore-failure")90 .long("ignore-failure")91 .short("i")92 .help("Ignore non-zero exit codes"),93 )94 .get_matches();9596 options.ignore_failure = matches.is_present("ignore-failure");9796 let str_to_u64 = |n| u64::from_str_radix(n, 10).ok();9798 options.warmup_count = matches99 .value_of("warmup")
4 unmodified lines
104 // we need at least two runs to compute a variance105 options.min_runs = cmp::max(2, min_runs);106 }107110 options.setup_command = matches.value_of("setup").map(String::from);108 options.preparation_command = matches.value_of("prepare").map(String::from);109110 options.ignore_failure = matches.is_present("ignore-failure");111112 let commands = matches.values_of("command").unwrap().collect();113 let res = run(&commands, &options);114115 match res {
4 unmodified lines
modified:README.md+17 added-8 removed