Struct iai_callgrind::BinaryBenchmarkGroup
source · pub struct BinaryBenchmarkGroup(/* private fields */);
Expand description
The BinaryBenchmarkGroup
lets you configure binary benchmark Run
s
Implementations§
source§impl BinaryBenchmarkGroup
impl BinaryBenchmarkGroup
sourcepub fn bench<T>(&mut self, run: T) -> &mut Selfwhere
T: Into<InternalRun>,
pub fn bench<T>(&mut self, run: T) -> &mut Selfwhere
T: Into<InternalRun>,
Specify a Run
to benchmark a binary
You can specify a crate’s binary either at group level with the simple name of the binary
(say my-exe
) or at bench
level with env!("CARGO_BIN_EXE_my-exe")
. See examples.
See also Run
for more details.
Examples
If your crate has a binary my-exe
(the name
key of a [[bin]]
entry in Cargo.toml),
specifying "my-exe"
in the benchmark argument sets the command for all Run
arguments and it’s sufficient to specify only Arg
with Run::with_arg
:
use iai_callgrind::{binary_benchmark_group, Arg, BinaryBenchmarkGroup, Run};
binary_benchmark_group!(
name = my_exe_group;
benchmark = |"my-exe", group: &mut BinaryBenchmarkGroup| {
group.bench(Run::with_arg(Arg::new("foo", &["foo"])));
}
);
Without the command
at group level:
use iai_callgrind::{binary_benchmark_group, Arg, BinaryBenchmarkGroup, Run};
binary_benchmark_group!(
name = my_exe_group;
benchmark = |group: &mut BinaryBenchmarkGroup| {
// Usually you should use `env!("CARGO_BIN_EXE_my-exe")` if `my-exe` is a binary
// of your crate
group.bench(Run::with_cmd("/path/to/my-exe", Arg::new("foo", &["foo"])));
}
);
Trait Implementations§
source§impl AsRef<BinaryBenchmarkGroup> for BinaryBenchmarkGroup
impl AsRef<BinaryBenchmarkGroup> for BinaryBenchmarkGroup
source§fn as_ref(&self) -> &BinaryBenchmarkGroup
fn as_ref(&self) -> &BinaryBenchmarkGroup
Converts this type into a shared reference of the (usually inferred) input type.
source§impl Clone for BinaryBenchmarkGroup
impl Clone for BinaryBenchmarkGroup
source§fn clone(&self) -> BinaryBenchmarkGroup
fn clone(&self) -> BinaryBenchmarkGroup
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for BinaryBenchmarkGroup
impl Debug for BinaryBenchmarkGroup
source§impl Default for BinaryBenchmarkGroup
impl Default for BinaryBenchmarkGroup
source§fn default() -> BinaryBenchmarkGroup
fn default() -> BinaryBenchmarkGroup
Returns the “default value” for a type. Read more
source§impl From<&BinaryBenchmarkGroup> for InternalBinaryBenchmarkGroup
impl From<&BinaryBenchmarkGroup> for InternalBinaryBenchmarkGroup
source§fn from(value: &BinaryBenchmarkGroup) -> Self
fn from(value: &BinaryBenchmarkGroup) -> Self
Converts to this type from the input type.
source§impl From<&mut BinaryBenchmarkGroup> for InternalBinaryBenchmarkGroup
impl From<&mut BinaryBenchmarkGroup> for InternalBinaryBenchmarkGroup
source§fn from(value: &mut BinaryBenchmarkGroup) -> Self
fn from(value: &mut BinaryBenchmarkGroup) -> Self
Converts to this type from the input type.
source§impl From<BinaryBenchmarkGroup> for BinaryBenchmarkGroup
impl From<BinaryBenchmarkGroup> for BinaryBenchmarkGroup
source§fn from(value: InternalBinaryBenchmarkGroup) -> Self
fn from(value: InternalBinaryBenchmarkGroup) -> Self
Converts to this type from the input type.
source§impl From<BinaryBenchmarkGroup> for InternalBinaryBenchmarkGroup
impl From<BinaryBenchmarkGroup> for InternalBinaryBenchmarkGroup
source§fn from(value: BinaryBenchmarkGroup) -> Self
fn from(value: BinaryBenchmarkGroup) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl RefUnwindSafe for BinaryBenchmarkGroup
impl Send for BinaryBenchmarkGroup
impl Sync for BinaryBenchmarkGroup
impl Unpin for BinaryBenchmarkGroup
impl UnwindSafe for BinaryBenchmarkGroup
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more