pub struct Subject {Show 18 fields
pub name: String,
pub cmd: Vec<String>,
pub prepare: Option<Vec<String>>,
pub setup: Option<Vec<String>>,
pub setup_dir: Option<PathBuf>,
pub check: Option<Vec<String>>,
pub version_cmd: Option<Vec<String>>,
pub dir: Option<PathBuf>,
pub env: BTreeMap<String, String>,
pub vars: BTreeMap<String, String>,
pub when: Option<String>,
pub runs: Runs,
pub auto: AutoRuns,
pub warmup: u32,
pub counters: bool,
pub allocations: bool,
pub ok_exit_codes: Vec<i32>,
pub metrics: BTreeMap<String, MetricSource>,
}Expand description
A subject with every default applied, ready to measure.
Fields§
§name: StringRecorded as Record::tool.
cmd: Vec<String>§prepare: Option<Vec<String>>§setup: Option<Vec<String>>Run once before the subject’s first sample. Always from the directory
holding tak.toml, never from dir; see Subject::anchor.
setup_dir: Option<PathBuf>Where setup runs: set by Subject::anchor to the directory holding
tak.toml. None runs it in tak’s own working directory.
check: Option<Vec<String>>Run after every timed sample, untimed. Exit 0 means the sample passed.
version_cmd: Option<Vec<String>>Run once, untimed, after setup and before the first warmup; its first
line of output is the version exported for this subject. See
crate::measure::interleaved_with_versions.
dir: Option<PathBuf>Relative to tak.toml; the caller resolves it.
env: BTreeMap<String, String>§vars: BTreeMap<String, String>Template values from vars tables, used by crate::template.
when: Option<String>Measured only when this holds; see crate::condition.
runs: Runs§auto: AutoRunsThe limits Runs::Auto works within.
warmup: u32§counters: bool§allocations: boolCount heap allocations under DHAT. Recorded and reported, never gated.
ok_exit_codes: Vec<i32>Exit codes a timed or warmup sample may end with and still count.
Never empty. A death by signal fails whatever this holds, and
setup and prepare are always held to exit 0.
metrics: BTreeMap<String, MetricSource>Custom metrics by name, recorded beside the timings. Empty unless a layer declares some.
Implementations§
Source§impl Subject
impl Subject
Sourcepub fn anchor(&mut self, root: &Path)
pub fn anchor(&mut self, root: &Path)
Resolve paths against root, the directory holding tak.toml.
dir becomes the working directory, but a relative program path — one
containing a /, like ./target/release/mycli — is resolved against
root, not dir. Otherwise giving a subject a fixture directory would
make the project’s own binary unfindable. A bare name is left for PATH
lookup, and arguments are never touched.
setup is the exception to dir: it runs in root itself. Its usual
job is to create or recreate dir — a clone, a generated project — and
a command cannot sensibly start inside a directory that does not exist
yet or that it is about to delete. Running it where dir is written
relative to also means the same path works as one of its arguments.
Choosing between the two by whether dir exists would give a setup a
different working directory on its second run than on its first.