Add run_bench
to Cargo.toml
.
This commit is contained in:
parent
93b7e55bcf
commit
7275141203
3 changed files with 10 additions and 7 deletions
|
@ -43,3 +43,7 @@ path = "tools/dump_events.rs"
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "time_parse"
|
name = "time_parse"
|
||||||
path = "tools/time_parse.rs"
|
path = "tools/time_parse.rs"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "run_bench"
|
||||||
|
path = "tools/run_bench.rs"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::{fs::File, io::BufWriter, io::Write, path::Path};
|
use std::{fs::File, io::BufWriter, io::Write, path::Path};
|
||||||
|
|
||||||
use anyhow::Error;
|
use anyhow::{Context, Error};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -51,11 +51,12 @@ fn run_bench(config: &Config) -> Result<(), Error> {
|
||||||
println!("Running {input_basename} against {}", parser.name);
|
println!("Running {input_basename} against {}", parser.name);
|
||||||
// Run benchmark
|
// Run benchmark
|
||||||
let path = Path::new(&parser.path).join("run_bench");
|
let path = Path::new(&parser.path).join("run_bench");
|
||||||
let output = std::process::Command::new(path)
|
let output = std::process::Command::new(&path)
|
||||||
.arg(input)
|
.arg(input)
|
||||||
.arg(&iterations)
|
.arg(&iterations)
|
||||||
.arg("--output-yaml")
|
.arg("--output-yaml")
|
||||||
.output()?;
|
.output()
|
||||||
|
.with_context(|| format!("While running {path:?} against {input}"))?;
|
||||||
// Check exit status.
|
// Check exit status.
|
||||||
if output.status.code().unwrap_or(1) == 0 {
|
if output.status.code().unwrap_or(1) == 0 {
|
||||||
let s = String::from_utf8_lossy(&output.stdout);
|
let s = String::from_utf8_lossy(&output.stdout);
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
#![allow(clippy::cast_possible_truncation, clippy::cast_precision_loss)]
|
#![allow(clippy::cast_possible_truncation, clippy::cast_precision_loss)]
|
||||||
|
|
||||||
use std::{env, fs::File, io::prelude::*};
|
|
||||||
use saphyr_parser::{
|
use saphyr_parser::{
|
||||||
parser::{MarkedEventReceiver, Parser},
|
Event, Marker, {MarkedEventReceiver, Parser},
|
||||||
scanner::Marker,
|
|
||||||
Event,
|
|
||||||
};
|
};
|
||||||
|
use std::{env, fs::File, io::prelude::*};
|
||||||
|
|
||||||
/// A sink which discards any event sent.
|
/// A sink which discards any event sent.
|
||||||
struct NullSink {}
|
struct NullSink {}
|
||||||
|
|
Loading…
Reference in a new issue