mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-01 00:40:19 +00:00
Rename functions
This commit is contained in:
1 parent
7c929f7e48
commit
f822455d99
5 files changed
+17
-11
No files matched your search
@@ -1,9 +1,9 @@
|
||||
use std::process::{ExitStatus, Stdio};
|
||||
|
||||
use crate::command::Command;
|
||||
use crate::execute::execute_and_measure;
|
||||
use crate::options::{CmdFailureAction, CommandOutputPolicy, Options, OutputStyleOption, Shell};
|
||||
use crate::output::progress_bar::get_progress_bar;
|
||||
use crate::shell::execute_and_time;
|
||||
use crate::timer::wallclocktimer::WallClockTimer;
|
||||
use crate::util::units::Second;
|
||||
|
||||
@@ -69,7 +69,7 @@ impl<'a> Executor for ShellExecutor<'a> {
|
||||
};
|
||||
|
||||
let wallclock_timer = WallClockTimer::start();
|
||||
let result = execute_and_time(stdout, stderr, &command.get_command_line(), self.shell)?;
|
||||
let result = execute_and_measure(stdout, stderr, &command.get_command_line(), self.shell)?;
|
||||
let mut time_real = wallclock_timer.stop();
|
||||
|
||||
let mut time_user = result.user_time;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use std::process::{ExitStatus, Stdio};
|
||||
|
||||
use crate::options::Shell;
|
||||
use crate::util::randomized_environment_offset;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
|
||||
@@ -17,13 +18,9 @@ pub struct ExecuteResult {
|
||||
pub status: ExitStatus,
|
||||
}
|
||||
|
||||
fn randomized_environment_offset_value() -> String {
|
||||
"X".repeat(rand::random::<usize>() % 4096usize)
|
||||
}
|
||||
|
||||
/// Execute the given command and return a timing summary
|
||||
#[cfg(not(windows))]
|
||||
pub fn execute_and_time(
|
||||
pub fn execute_and_measure(
|
||||
stdout: Stdio,
|
||||
stderr: Stdio,
|
||||
command: &str,
|
||||
@@ -37,7 +34,7 @@ pub fn execute_and_time(
|
||||
.arg(command)
|
||||
.env(
|
||||
"HYPERFINE_RANDOMIZED_ENVIRONMENT_OFFSET",
|
||||
randomized_environment_offset_value(),
|
||||
randomized_environment_offset::value(),
|
||||
)
|
||||
.stdin(Stdio::null())
|
||||
.stdout(stdout)
|
||||
@@ -56,7 +53,7 @@ pub fn execute_and_time(
|
||||
|
||||
/// Execute the given command and return a timing summary
|
||||
#[cfg(windows)]
|
||||
pub fn execute_and_time(
|
||||
pub fn execute_and_measure(
|
||||
stdout: Stdio,
|
||||
stderr: Stdio,
|
||||
command: &str,
|
||||
@@ -68,7 +65,7 @@ pub fn execute_and_time(
|
||||
.arg(command)
|
||||
.env(
|
||||
"HYPERFINE_RANDOMIZED_ENVIRONMENT_OFFSET",
|
||||
randomized_environment_offset_value(),
|
||||
randomized_environment_offset::value(),
|
||||
)
|
||||
.stdin(Stdio::null())
|
||||
.stdout(stdout)
|
||||
+1
-1
@@ -13,12 +13,12 @@ pub mod app;
|
||||
pub mod benchmark;
|
||||
pub mod command;
|
||||
pub mod error;
|
||||
pub mod execute;
|
||||
pub mod export;
|
||||
pub mod options;
|
||||
pub mod outlier_detection;
|
||||
pub mod output;
|
||||
pub mod parameter;
|
||||
pub mod shell;
|
||||
pub mod timer;
|
||||
pub mod util;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
pub mod exit_code;
|
||||
pub mod min_max;
|
||||
pub mod number;
|
||||
pub mod randomized_environment_offset;
|
||||
pub mod units;
|
||||
@@ -0,0 +1,8 @@
|
||||
/// Returns a string with a random length. This value will be set as an environment
|
||||
/// variable to account for offset effects. See [1] for more details.
|
||||
///
|
||||
/// [1] Mytkowicz, 2009. Producing Wrong Data Without Doing Anything Obviously Wrong!.
|
||||
/// Sigplan Notices - SIGPLAN. 44. 265-276. 10.1145/1508284.1508275.
|
||||
pub fn value() -> String {
|
||||
"X".repeat(rand::random::<usize>() % 4096usize)
|
||||
}
|
||||
Reference in new issue
Block a user