Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@ Create a JSON or YAML file with the following properties:
* **`iterations`**: The number of times to run the the `run` test. The results
for each iteration will be in an `iterations` array in the resultant JSON. The
default is 1.
* **`cachegrind`**: If set to `true`, will run the test (after having already
run it normally) using cachegrind to add an instruction count to the results
JSON. Will only happen once, and be inserted into the top level JSON,
regardless of `iterations`. This requires that `valgrind` is installed on your
system.
* **`instructions`**: If set to `true`, will take instruction counts from
hardware counters if available, adding the result under the key
`instructions`, for each iteration. This is only available on Linux with
Expand Down
4 changes: 0 additions & 4 deletions examples/cachegrind.json

This file was deleted.

9 changes: 0 additions & 9 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pub(crate) struct Config {
pub(crate) run: Vec<String>,
pub(crate) timeout: Option<u64>,
pub(crate) env: HashMap<String, String>,
pub(crate) cachegrind: bool,
pub(crate) iterations: u64,
pub(crate) instructions: bool,
pub(crate) variants: Option<Vec<String>>,
Expand Down Expand Up @@ -70,7 +69,6 @@ lazy_static! {
static ref SETUP_KEY: Value = "setup".into();
static ref TEARDOWN_KEY: Value = "teardown".into();
static ref TIMEOUT_KEY: Value = "timeout".into();
static ref CACHEGRIND_KEY: Value = "cachegrind".into();
static ref ITERATIONS_KEY: Value = "iterations".into();
static ref INSTRUCTIONS_KEY: Value = "instructions".into();
}
Expand Down Expand Up @@ -115,12 +113,6 @@ fn apply_config(config: &mut Config, config_val: &Value) -> Result<()> {
);
}

if let Some(cachegrind_val) = config_val.get(&CACHEGRIND_KEY) {
config.cachegrind = cachegrind_val
.as_bool()
.ok_or_else(|| anyhow!("'cachegrind' must be a boolean"))?;
}

if let Some(iterations_val) = config_val.get(&ITERATIONS_KEY) {
config.iterations = iterations_val
.as_u64()
Expand Down Expand Up @@ -150,7 +142,6 @@ pub(crate) fn get_config(filename: &str) -> Result<Config> {
run: vec!["INIT".into()],
timeout: None,
env: HashMap::new(),
cachegrind: false,
instructions: false,
iterations: 1,
variants: None,
Expand Down
40 changes: 0 additions & 40 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,46 +190,6 @@ async fn main_main() -> Result<()> {
}
metrics.insert("iterations".into(), MetricValue::Arr(iterations));

if config.cachegrind && which("valgrind").is_ok() {
let command = "valgrind";
let mut args = vec![
"--tool=cachegrind".to_owned(),
"--trace-children=yes".to_owned(),
// Set some reasonable L1 and LL values. It is important that these
// values are consistent across runs, instead of the default.
"--I1=32768,8,64".to_owned(),
"--D1=32768,8,64".to_owned(),
"--LL=8388608,16,64".to_owned(),
];
args.append(&mut config.run.clone());
run_setup(&config).await?;
let output = Command::new(command)
.args(args)
.envs(&config.env)
.output()
.await?;
run_teardown(&config).await?;
let stderr = String::from_utf8_lossy(&output.stderr);

let lines = stderr.trim().lines().filter(|x| x.contains("I refs:"));
let mut instructions: f64 = 0.0;
for line in lines {
instructions += line
.trim()
.split_whitespace()
.last()
.expect("Bad cachegrind output: invalid instruction ref line")
.replace(",", "")
.parse::<f64>()
.expect("Bad cachegrind output: invalid number");
}
if instructions <= 0.0 {
eprintln!("Bad cachegrind output: no instructions parsed");
exit(1);
}
metrics.insert("instructions".into(), instructions.into());
}

if let Ok(hash) = env::var("GIT_COMMIT_HASH") {
metrics.insert("version".into(), hash.into());
}
Expand Down
16 changes: 0 additions & 16 deletions tests/examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,22 +178,6 @@ fn stdio() {
.stdout(predicate::str::contains("setup was run").not());
}

#[test]
#[serial]
fn cachegrind() {
if std::env::consts::OS == "linux" {
run!("./examples/cachegrind.json")
.assert()
.success()
.stdout(predicate::str::contains("\"instructions\":"));
} else {
run!("./examples/cachegrind.json")
.assert()
.success()
.stdout(predicate::str::contains("\"instructions\":").not());
}
}

#[test]
#[serial]
fn iterations() {
Expand Down