Struct test::MetricMap
pub struct MetricMap(TreeMap<~str, Metric>);
Methods
impl MetricMap
fn new() -> MetricMap
fn load(p: &Path) -> MetricMap
Load MetricDiff from a file.
Failure
This function will fail if the path does not exist or the path does not contain a valid metric map.
fn save(&self, p: &Path) -> IoResult<()>
Write MetricDiff to a file.
fn compare_to_old(&self, old: &MetricMap, noise_pct: Option<f64>) -> MetricDiff
Compare against another MetricMap. Optionally compare all
measurements in the maps using the provided noise_pct
as a
percentage of each value to consider noise. If None
, each
measurement's noise threshold is independently chosen as the
maximum of that measurement's recorded noise quantity in either
map.
fn insert_metric(&mut self, name: &str, value: f64, noise: f64)
Insert a named value
(+/- noise
) metric into the map. The value
must be non-negative. The noise
indicates the uncertainty of the
metric, which doubles as the "noise range" of acceptable
pairwise-regressions on this named value, when comparing from one
metric to the next using compare_to_old
.
If noise
is positive, then it means this metric is of a value
you want to see grow smaller, so a change larger than noise
in the
positive direction represents a regression.
If noise
is negative, then it means this metric is of a value
you want to see grow larger, so a change larger than noise
in the
negative direction represents a regression.
fn ratchet(&self, p: &Path, pct: Option<f64>) -> (MetricDiff, bool)
Attempt to "ratchet" an external metric file. This involves loading
metrics from a metric file (if it exists), comparing against
the metrics in self
using compare_to_old
, and rewriting the
file to contain the metrics in self
if none of the
MetricChange
s are Regression
. Returns the diff as well
as a boolean indicating whether the ratchet succeeded.