iai_callgrind_runner::runner::tool

Struct ToolOutputPath

source
pub struct ToolOutputPath {
    pub kind: ToolOutputPathKind,
    pub tool: ValgrindTool,
    pub baseline_kind: BaselineKind,
    pub dir: PathBuf,
    pub name: String,
    pub modifiers: Vec<String>,
}
Available on crate feature runner only.

Fields§

§kind: ToolOutputPathKind§tool: ValgrindTool§baseline_kind: BaselineKind§dir: PathBuf

The final directory of all the output files

§name: String§modifiers: Vec<String>

Implementations§

source§

impl ToolOutputPath

source

pub fn new( kind: ToolOutputPathKind, tool: ValgrindTool, baseline_kind: &BaselineKind, base_dir: &Path, module: &ModulePath, name: &str, ) -> Self

Create a new ToolOutputPath.

The base_dir is supposed to be the same as crate::runner::meta::Metadata::target_dir.

source

pub fn with_init( kind: ToolOutputPathKind, tool: ValgrindTool, baseline_kind: &BaselineKind, base_dir: &Path, module: &str, name: &str, ) -> Result<Self>

Initialize and create the output directory and organize files

This method moves the old output to $TOOL_ID.*.out.old

source

pub fn init(&self) -> Result<()>

source

pub fn clear(&self) -> Result<()>

source

pub fn shift(&self) -> Result<()>

source

pub fn exists(&self) -> bool

source

pub fn is_multiple(&self) -> bool

source

pub fn to_base_path(&self) -> Self

source

pub fn to_tool_output(&self, tool: ValgrindTool) -> Self

source

pub fn to_log_output(&self) -> Self

source

pub fn dump_log(&self, log_level: Level, writer: &mut impl Write) -> Result<()>

source

pub fn extension(&self) -> String

This method can only be used to create the path passed to the tools

The modifiers are extrapolated by the tools and won’t match any real path name.

source

pub fn with_modifiers<I, T>(&self, modifiers: T) -> Self
where I: Into<String>, T: IntoIterator<Item = I>,

source

pub fn to_path(&self) -> PathBuf

source

pub fn walk_dir(&self) -> Result<impl Iterator<Item = DirEntry>>

Walk the benchmark directory (non-recursive)

source

pub fn strip_prefix<'a>(&self, file_name: &'a str) -> Option<&'a str>

Strip the <tool>.<name> prefix from a file_name

source

pub fn prefix(&self) -> String

Return the file name prefix as in <tool>.<name>

source

pub fn real_paths(&self) -> Result<Vec<PathBuf>>

Return the real paths of a tool’s output files

A tool can have many output files so Self::to_path is not enough

source

pub fn real_paths_with_modifier(&self) -> Result<Vec<(PathBuf, Option<String>)>>

source

pub fn sanitize_callgrind(&self) -> Result<()>

Sanitize callgrind output file names

This method will remove empty files which are occasionally produced by callgrind and only cause problems in the parser. The files are renamed from the callgrind file naming scheme to ours which is easier to handle.

The information about pids, parts and threads is obtained by parsing the header from the callgrind output files instead of relying on the sometimes flaky file names produced by callgrind. The header is around 10-20 lines, so this method should be still sufficiently fast. Additionally, callgrind might change the naming scheme of its files, so using the headers makes us more independent of a specific valgrind/callgrind version.

source

pub fn sanitize_bbv(&self) -> Result<()>

source

pub fn sanitize_generic(&self) -> Result<()>

Sanitize file names of all tools if not sanitized by a more specific method

The pids are removed from the file name if there was only a single process (pid). Additionally, we check for empty files and remove them.

source

pub fn sanitize(&self) -> Result<()>

Sanitize file names for a specific tool

Empty files are cleaned up. For more details on a specific tool see the respective sanitize_ method.

Trait Implementations§

source§

impl Clone for ToolOutputPath

source§

fn clone(&self) -> ToolOutputPath

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ToolOutputPath

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for ToolOutputPath

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for ToolOutputPath

source§

fn eq(&self, other: &ToolOutputPath) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for ToolOutputPath

source§

impl StructuralPartialEq for ToolOutputPath

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.