pub struct ToolOutputPath {
pub baseline_kind: BaselineKind,
pub dir: PathBuf,
pub kind: ToolOutputPathKind,
pub modifiers: Vec<String>,
pub name: String,
pub tool: ValgrindTool,
}runner only.Expand description
The tool specific output path(s)
Fields§
§baseline_kind: BaselineKindThe BaselineKind
dir: PathBufThe final directory of all the output files
kind: ToolOutputPathKind§modifiers: Vec<String>The modifiers which are prepended to the extension
name: StringThe name of this output path
tool: ValgrindToolThe tool
Implementations§
Source§impl ToolOutputPath
impl ToolOutputPath
Sourcepub fn new(
kind: ToolOutputPathKind,
tool: ValgrindTool,
baseline_kind: &BaselineKind,
base_dir: &Path,
module: &ModulePath,
name: &str,
) -> Self
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.
The name is supposed to be the name of the benchmark function. If a benchmark id is
present join both with a dot as separator to get the final name.
Sourcepub fn with_init(
kind: ToolOutputPathKind,
tool: ValgrindTool,
baseline_kind: &BaselineKind,
base_dir: &Path,
module: &str,
name: &str,
) -> Result<Self>
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
Sourcepub fn shift(&self) -> Result<()>
pub fn shift(&self) -> Result<()>
Remove the old or base files and rename the present files to “old” files
Sourcepub fn is_multiple(&self) -> bool
pub fn is_multiple(&self) -> bool
Return true if there are multiple real files of this output path
Sourcepub fn to_base_path(&self) -> Self
pub fn to_base_path(&self) -> Self
Convert this output path to a base output path
Sourcepub fn to_tool_output(&self, tool: ValgrindTool) -> Self
pub fn to_tool_output(&self, tool: ValgrindTool) -> Self
Convert this tool output path to the output of another tool output path
A tool with no *.out file is log-file based. If the other tool is a out-file based tool
the ToolOutputPathKind will be converted and vice-versa. The “old” (base) type (a tool
output converted with ToolOutputPath::to_base_path) will be converted to a new
ToolOutputPath.
Sourcepub fn to_log_output(&self) -> Self
pub fn to_log_output(&self) -> Self
Convert this tool output to the according log output
All tools have a log output even the ones which are out-file based.
Sourcepub fn to_xtree_output(&self) -> Option<Self>
pub fn to_xtree_output(&self) -> Option<Self>
If possible, convert this tool output to the according xtree output
Not all tools support xtree output files
Sourcepub fn to_xleak_output(&self) -> Option<Self>
pub fn to_xleak_output(&self) -> Option<Self>
If possible, convert this tool output to the according xleak output
Not all tools support xleak output files
Sourcepub fn log_path_of(&self, path: &Path) -> Option<PathBuf>
pub fn log_path_of(&self, path: &Path) -> Option<PathBuf>
Return the path to the log file for the given path
path is supposed to be a path to a valid file in the directory of this ToolOutputPath.
Sourcepub fn dump_log<W>(&self, log_level: Level, writer: &mut W) -> Result<()>where
W: Write,
pub fn dump_log<W>(&self, log_level: Level, writer: &mut W) -> Result<()>where
W: Write,
If the log::Level matches dump the content of all output files into the writer
Sourcepub fn extension(&self) -> String
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.
Sourcepub fn with_modifiers<I, T>(&self, modifiers: T) -> Self
pub fn with_modifiers<I, T>(&self, modifiers: T) -> Self
Create new ToolOutputPath with modifiers
Sourcepub fn to_path(&self) -> PathBuf
pub fn to_path(&self) -> PathBuf
Return the unexpanded path usable as input for --callgrind-out-file, …
The path returned by this method does not necessarily have to exist and can include
modifiers like %p. Use Self::real_paths to get the real and existing (possibly
multiple) paths to the output files of the respective tool.
Sourcepub fn walk_dir(&self) -> Result<impl Iterator<Item = DirEntry>>
pub fn walk_dir(&self) -> Result<impl Iterator<Item = DirEntry>>
Walk the benchmark directory (non-recursive)
Sourcepub fn strip_prefix<'a>(&self, file_name: &'a str) -> Option<&'a str>
pub fn strip_prefix<'a>(&self, file_name: &'a str) -> Option<&'a str>
Strip the <tool>.<name> prefix from a file_name
Sourcepub fn real_paths(&self) -> Result<Vec<PathBuf>>
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
Sourcepub fn real_paths_with_modifier(&self) -> Result<Vec<(PathBuf, Option<String>)>>
pub fn real_paths_with_modifier(&self) -> Result<Vec<(PathBuf, Option<String>)>>
Return the real paths with their respective modifiers if present
Sourcepub fn sanitize_callgrind(&self) -> Result<()>
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.
Sourcepub fn sanitize_bbv(&self) -> Result<()>
pub fn sanitize_bbv(&self) -> Result<()>
Sanitize bbv file names
The original output files of bb have a .<number> suffix if there are multiple threads. We
need the threads as t<number> in the modifier part of the final file names.
For example: (orig -> sanitized)
If there are multiple threads, the bb output file name doesn’t include the first thread:
exp-bbv.bench_thread_in_subprocess.548365.bb.out ->
exp-bbv.bench_thread_in_subprocess.548365.t1.bb.out
exp-bbv.bench_thread_in_subprocess.548365.bb.out.2 ->
exp-bbv.bench_thread_in_subprocess.548365.t2.bb.out
Sourcepub fn sanitize_generic(&self) -> Result<()>
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.
Trait Implementations§
Source§impl Clone for ToolOutputPath
impl Clone for ToolOutputPath
Source§fn clone(&self) -> ToolOutputPath
fn clone(&self) -> ToolOutputPath
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ToolOutputPath
impl Debug for ToolOutputPath
Source§impl Display for ToolOutputPath
impl Display for ToolOutputPath
Source§impl PartialEq for ToolOutputPath
impl PartialEq for ToolOutputPath
impl Eq for ToolOutputPath
impl StructuralPartialEq for ToolOutputPath
Auto Trait Implementations§
impl Freeze for ToolOutputPath
impl RefUnwindSafe for ToolOutputPath
impl Send for ToolOutputPath
impl Sync for ToolOutputPath
impl Unpin for ToolOutputPath
impl UnwindSafe for ToolOutputPath
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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