From 7709607c484f991ca16dbba0699535ef45994090 Mon Sep 17 00:00:00 2001 From: Sven-Hendrik Haase Date: Tue, 29 Oct 2019 16:34:16 +0100 Subject: [PATCH 1/5] WIP --- Cargo.lock | 50 +++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 1 + src/args.rs | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main.rs | 4 +++- 4 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 src/args.rs diff --git a/Cargo.lock b/Cargo.lock index 16f47ee..224b9c9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -45,6 +45,7 @@ dependencies = [ "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -66,6 +67,14 @@ name = "either" version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "heck" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "itertools" version = "0.8.1" @@ -141,6 +150,16 @@ dependencies = [ "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "proc-macro-error" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "proc-macro2" version = "1.0.6" @@ -216,6 +235,27 @@ name = "strsim" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "structopt" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt-derive 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "structopt-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "syn" version = "1.0.7" @@ -242,6 +282,11 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "unicode-segmentation" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "unicode-width" version = "0.1.6" @@ -284,6 +329,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" "checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" +"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "87fa75c9dea7b07be3138c49abbb83fd4bea199b5cdc76f9804458edc5da0d6e" "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" @@ -294,6 +340,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum num-complex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fcb0cf31fb3ff77e6d2a6ebd6800df7fdcd106f2ad89113c9130bcd07f93dffc" "checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" "checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" +"checksum proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aeccfe4d5d8ea175d5f0e4a2ad0637e0f4121d63bd99d356fb1f39ab2e7c6097" "checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27" "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" "checksum rawpointer 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" @@ -304,9 +351,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)" = "ca13fc1a832f793322228923fbb3aba9f3f44444898f835d31ad1b74fa0a2bf8" "checksum serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "2f72eb2a68a7dc3f9a691bfda9305a1c017a6215e5a4545c258500d2099a37c2" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +"checksum structopt 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4f66a4c0ddf7aee4677995697366de0749b0139057342eccbb609b12d0affc" +"checksum structopt-derive 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8fe0c13e476b4e21ff7f5c4ace3818b6d7bdc16897c31c73862471bc1663acae" "checksum syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7bedb3320d0f3035594b0b723c8a28d7d336a3eda3881db79e61d676fb644c" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" +"checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9" "checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20" "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" diff --git a/Cargo.toml b/Cargo.toml index cb396f2..27556b0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,3 +16,4 @@ ndarray = "0.13" lazy_static = "1" serde = { version = "1", features = ["derive"] } serde_json = "1" +structopt = "0.3" diff --git a/src/args.rs b/src/args.rs new file mode 100644 index 0000000..bc24f2d --- /dev/null +++ b/src/args.rs @@ -0,0 +1,65 @@ +use structopt::StructOpt; + +#[derive(Debug, Clone, StructOpt)] +#[structopt( + name = "cargo-profiler", + author, + about, + global_settings = &[structopt::clap::AppSettings::ColoredHelp] +)] +pub enum CargoProfilerConfig { + Profiler { + #[structopt(subcommand)] + profiler_type: ProfilerType, + } +} + +#[derive(Debug, Clone, StructOpt)] +pub enum ProfilerType { + Callgrind { + /// Binary you want to profile + #[structopt(name = "BIN", long)] + binary: String, + + /// Arguments for the binary + #[structopt(name = "ARG")] + bin_args: Vec, + + /// Build binary in release mode + #[structopt(long)] + release: bool, + + /// Number of functions you want + #[structopt(short)] + n_functions: u16, + + /// Keep profiler output files + #[structopt(short, long)] + keep: bool, + }, + Cachegrind { + /// Binary you want to profile + #[structopt(name = "BIN", long)] + binary: String, + + /// Arguments for the binary + #[structopt(name = "ARG")] + bin_args: Vec, + + /// Build binary in release mode + #[structopt(long)] + release: bool, + + /// Number of functions you want + #[structopt(short)] + n_functions: u16, + + /// Metric you want to sort by + #[structopt(short, long)] + sort: String, + + /// Keep profiler output files + #[structopt(short, long)] + keep: bool, + }, +} diff --git a/src/main.rs b/src/main.rs index df625e0..77bc04a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ pub mod argparse; +pub mod args; pub mod cargo; pub mod display; pub mod err; @@ -15,6 +16,7 @@ use clap::{App, AppSettings, Arg, SubCommand}; use std::ffi::OsStr; use std::process; use std::process::Command; +use structopt::StructOpt; // macro to try something, but print custom error message and exit upon error. macro_rules! try_or_exit { @@ -30,6 +32,7 @@ macro_rules! try_or_exit { } fn main() { + dbg!(args::CargoProfilerConfig::from_args()); let _ = real_main(); } @@ -76,7 +79,6 @@ fn real_main() -> Result<(), ProfError> { .required(false) .help("keep profiler output files"); - // create callgrind subcommand let callgrind = SubCommand::with_name("callgrind") .about("gets callgrind features") From a2dff232ce6b10e2e476b5ae1469274226b5c423 Mon Sep 17 00:00:00 2001 From: Sven-Hendrik Haase Date: Wed, 30 Oct 2019 08:54:03 +0100 Subject: [PATCH 2/5] Some progress --- Cargo.lock | 29 +++++- Cargo.toml | 5 +- src/argparse.rs | 14 --- src/args.rs | 15 +-- src/main.rs | 223 ++++++++++++---------------------------- src/parse/cachegrind.rs | 2 + 6 files changed, 107 insertions(+), 181 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 224b9c9..5b4936c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16,6 +16,11 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "anyhow" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "atty" version = "0.2.13" @@ -37,8 +42,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cargo-profiler" -version = "0.2.0" +version = "1.1.0" dependencies = [ + "anyhow 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "ndarray 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -46,6 +52,8 @@ dependencies = [ "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "structopt 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "strum 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", + "strum_macros 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -256,6 +264,22 @@ dependencies = [ "syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "strum" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "strum_macros" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "syn" version = "1.0.7" @@ -324,6 +348,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +"checksum anyhow 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "ab335240fd942ab8191c5e628cd4ff3903c577bda961fb75df08e0303a00527b" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" "checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" @@ -353,6 +378,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum structopt 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4f66a4c0ddf7aee4677995697366de0749b0139057342eccbb609b12d0affc" "checksum structopt-derive 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8fe0c13e476b4e21ff7f5c4ace3818b6d7bdc16897c31c73862471bc1663acae" +"checksum strum 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6138f8f88a16d90134763314e3fc76fa3ed6a7db4725d6acf9a3ef95a3188d22" +"checksum strum_macros 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0054a7df764039a6cd8592b9de84be4bec368ff081d203a7d5371cbfa8e65c81" "checksum syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7bedb3320d0f3035594b0b723c8a28d7d336a3eda3881db79e61d676fb644c" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" diff --git a/Cargo.toml b/Cargo.toml index 27556b0..eb6c7cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo-profiler" -version = "0.2.0" +version = "1.1.0" authors = ["pegasos1", "Sven-Hendrik Haase "] description = "Cargo subcommand to profile your applications." homepage = "http://github.com/svenstaro/cargo-profiler" @@ -17,3 +17,6 @@ lazy_static = "1" serde = { version = "1", features = ["derive"] } serde_json = "1" structopt = "0.3" +anyhow = "1" +strum = "0.16" +strum_macros = "0.16" diff --git a/src/argparse.rs b/src/argparse.rs index 54b6fd8..7945e07 100644 --- a/src/argparse.rs +++ b/src/argparse.rs @@ -34,15 +34,6 @@ pub fn get_binary<'a>(matches: &'a ArgMatches) -> Result<&'a str, ProfError> { } } -/// parse the number argument into a usize -pub fn get_num(matches: &ArgMatches) -> Result { - match matches.value_of("n").map(|x| x.parse::()) { - Some(Ok(z)) => Ok(z), - Some(Err(_)) => Err(ProfError::InvalidNum), - None => Ok(10000), // some arbitrarily large number... - } -} - /// get the cachegrind metric user wants to sort on pub fn get_sort_metric(matches: &ArgMatches) -> Result { match matches.value_of("sort") { @@ -73,11 +64,6 @@ mod test { assert_eq!(1, 1); } - #[test] - fn test_get_num() { - assert_eq!(1, 1); - } - #[test] fn test_get_sort_metric() { assert_eq!(1, 1); diff --git a/src/args.rs b/src/args.rs index bc24f2d..ba9d4dc 100644 --- a/src/args.rs +++ b/src/args.rs @@ -1,4 +1,5 @@ use structopt::StructOpt; +use crate::parse::cachegrind::Metric; #[derive(Debug, Clone, StructOpt)] #[structopt( @@ -16,10 +17,11 @@ pub enum CargoProfilerConfig { #[derive(Debug, Clone, StructOpt)] pub enum ProfilerType { + /// Run callgrind Callgrind { /// Binary you want to profile #[structopt(name = "BIN", long)] - binary: String, + binary: Option, /// Arguments for the binary #[structopt(name = "ARG")] @@ -30,17 +32,18 @@ pub enum ProfilerType { release: bool, /// Number of functions you want - #[structopt(short)] + #[structopt(short, default_value = "10000")] n_functions: u16, /// Keep profiler output files #[structopt(short, long)] keep: bool, }, + /// Run cachegrind Cachegrind { /// Binary you want to profile #[structopt(name = "BIN", long)] - binary: String, + binary: Option, /// Arguments for the binary #[structopt(name = "ARG")] @@ -51,12 +54,12 @@ pub enum ProfilerType { release: bool, /// Number of functions you want - #[structopt(short)] + #[structopt(short, default_value = "10000")] n_functions: u16, /// Metric you want to sort by - #[structopt(short, long)] - sort: String, + #[structopt(short, long, default_value = "NAN")] + sort: Metric, /// Keep profiler output files #[structopt(short, long)] diff --git a/src/main.rs b/src/main.rs index 77bc04a..984c37c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,7 +6,7 @@ pub mod err; pub mod parse; pub mod profiler; -use crate::argparse::{get_binary, get_num, get_profiler, get_sort_metric}; +use crate::argparse::{get_binary, get_profiler, get_sort_metric}; use crate::cargo::build_binary; use crate::err::ProfError; use crate::parse::cachegrind::CacheGrindParser; @@ -17,164 +17,69 @@ use std::ffi::OsStr; use std::process; use std::process::Command; use structopt::StructOpt; - -// macro to try something, but print custom error message and exit upon error. -macro_rules! try_or_exit { - ($e:expr) => { - match $e { - Ok(e) => e, - Err(e) => { - println!("{}", e); - process::exit(1); - } - } - }; -} - -fn main() { - dbg!(args::CargoProfilerConfig::from_args()); - let _ = real_main(); -} - -// #[cfg(all(unix, any(target_os = "linux", target_os = "macos")))] -#[cfg(unix)] -fn real_main() -> Result<(), ProfError> { - // create binary path argument - let binary_arg = Arg::with_name("binary") - .long("bin") - .value_name("BINARY") - .required(false) - .help("binary you want to profile"); - - // create binary arguments positional args (aka, everything after a '--') - let binargs_arg = Arg::with_name("binargs") - .multiple(true) - .value_name("BIN_ARGS") - .required(false) - .help("arguments to the binary when executed"); - - // create release argument - let release = Arg::with_name("release") - .long("release") - .required(false) - .help("whether binary should be built in release mode"); - - // create function count argument - let fn_count_arg = Arg::with_name("n") - .short("n") - .value_name("NUMBER") - .takes_value(true) - .help("number of functions you want"); - - // create sort metric argument - let sort_arg = Arg::with_name("sort") - .long("sort") - .value_name("SORT") - .takes_value(true) - .help("metric you want to sort by"); - - // keep output files - let keep_arg = Arg::with_name("keep") - .long("keep") - .required(false) - .help("keep profiler output files"); - - // create callgrind subcommand - let callgrind = SubCommand::with_name("callgrind") - .about("gets callgrind features") - .version("1.0") - .author("Suchin Gururangan") - .arg(release.clone()) - .arg(binary_arg.clone()) - .arg(binargs_arg.clone()) - .arg(fn_count_arg.clone()) - .arg(keep_arg.clone()); - - // create cachegrind subcommand - let cachegrind = SubCommand::with_name("cachegrind") - .about("gets cachegrind features") - .version("1.0") - .author("Suchin Gururangan") - .arg(release) - .arg(binary_arg) - .arg(binargs_arg.clone()) - .arg(fn_count_arg) - .arg(sort_arg) - .arg(keep_arg); - - // create profiler subcommand - let profiler = SubCommand::with_name("profiler") - .about("gets callgrind features") - .version("1.0") - .author("Suchin Gururangan") - .subcommand(callgrind) - .subcommand(cachegrind); - - // create profiler application - let matches = App::new("cargo-profiler") - .bin_name("cargo") - .settings(&[AppSettings::SubcommandRequired]) - .version("1.0") - .author("Suchin Gururangan") - .about("Profile your binaries") - .subcommand(profiler) - .get_matches(); - - // parse arguments from cli call - let (m, profiler) = try_or_exit!(get_profiler(&matches)); - let binary = { - if m.is_present("binary") { - try_or_exit!(get_binary(&m)).to_string() - } else if m.is_present("release") { - try_or_exit!(build_binary(true)) - } else { - try_or_exit!(build_binary(false)) - } - }; - - let binary_name = binary.split('/').collect::>().pop().unwrap_or(""); - let binargs: Vec<&OsStr> = match m.values_of_os("binargs") { - None => vec![], - Some(raw) => raw.collect(), - }; - - let num = try_or_exit!(get_num(&m)); - let sort_metric = try_or_exit!(get_sort_metric(&m)); - - match profiler { - Profiler::CallGrind { .. } => println!( - "\n\x1b[1;33mProfiling \x1b[1;0m{} \x1b[0mwith callgrind\x1b[0m...", - binary_name - ), - Profiler::CacheGrind { .. } => println!( - "\n\x1b[1;33mProfiling \x1b[1;0m{} \x1b[0mwith cachegrind\x1b[0m...", - binary_name - ), - }; - - // get the profiler output - let output = match profiler { - Profiler::CallGrind { .. } => profiler.callgrind_cli(&binary, &binargs)?, - Profiler::CacheGrind { .. } => profiler.cachegrind_cli(&binary, &binargs)?, - }; - - // parse the output into struct - let parsed = match profiler { - Profiler::CallGrind { .. } => try_or_exit!(profiler.callgrind_parse(&output, num)), - Profiler::CacheGrind { .. } => { - try_or_exit!(profiler.cachegrind_parse(&output, num, sort_metric)) - } - }; - - // pretty-print - println!("{}", parsed); - - if !m.is_present("keep") { - // remove files generated while profiling - Command::new("rm").arg("cachegrind.out").output()?; - - Command::new("rm").arg("callgrind.out").output()?; - } +use anyhow::Result; + +fn main() -> Result<()> { + let args = args::CargoProfilerConfig::from_args(); + dbg!(args); + + // match args.profiler_type { + // Profiler::CallGrind { .. } => println!( + // "\n\x1b[1;33mProfiling \x1b[1;0m{} \x1b[0mwith callgrind\x1b[0m...", + // binary_name + // ), + // Profiler::CacheGrind { .. } => println!( + // "\n\x1b[1;33mProfiling \x1b[1;0m{} \x1b[0mwith cachegrind\x1b[0m...", + // binary_name + // ), + // }; + // + // // parse arguments from cli call + // let (m, profiler) = try_or_exit!(get_profiler(&matches)); + // let binary = { + // if m.is_present("binary") { + // try_or_exit!(get_binary(&m)).to_string() + // } else if m.is_present("release") { + // try_or_exit!(build_binary(true)) + // } else { + // try_or_exit!(build_binary(false)) + // } + // }; + // + // let binary_name = binary.split('/').collect::>().pop().unwrap_or(""); + // let binargs: Vec<&OsStr> = match m.values_of_os("binargs") { + // None => vec![], + // Some(raw) => raw.collect(), + // }; + // + // let num = try_or_exit!(get_num(&m)); + // let sort_metric = try_or_exit!(get_sort_metric(&m)); + // + // + // // get the profiler output + // let output = match profiler { + // Profiler::CallGrind { .. } => profiler.callgrind_cli(&binary, &binargs)?, + // Profiler::CacheGrind { .. } => profiler.cachegrind_cli(&binary, &binargs)?, + // }; + // + // // parse the output into struct + // let parsed = match profiler { + // Profiler::CallGrind { .. } => try_or_exit!(profiler.callgrind_parse(&output, num)), + // Profiler::CacheGrind { .. } => { + // try_or_exit!(profiler.cachegrind_parse(&output, num, sort_metric)) + // } + // }; + // + // + // + // // pretty-print + // println!("{}", parsed); + // + // if !args.keep { + // // remove files generated while profiling + // Command::new("rm").arg("cachegrind.out").output()?; + // Command::new("rm").arg("callgrind.out").output()?; + // } Ok(()) } diff --git a/src/parse/cachegrind.rs b/src/parse/cachegrind.rs index feaf52d..dce4db6 100644 --- a/src/parse/cachegrind.rs +++ b/src/parse/cachegrind.rs @@ -6,8 +6,10 @@ use regex::Regex; use std::cmp::Ordering::Less; use std::ffi::OsStr; use std::process::Command; +use strum_macros::EnumString; /// define cachegrind metrics +#[derive(Debug, Clone, EnumString)] pub enum Metric { Ir, I1mr, From c803108ecfceb992a79e17dcf633b6a849785d2e Mon Sep 17 00:00:00 2001 From: Sven-Hendrik Haase Date: Fri, 1 Nov 2019 07:05:38 +0100 Subject: [PATCH 3/5] WIP --- src/display.rs | 4 ++-- src/main.rs | 37 ++++++++++++++++++++++--------------- src/parse/cachegrind.rs | 6 +++--- src/parse/callgrind.rs | 8 ++++---- src/profiler.rs | 16 ++++++++-------- 5 files changed, 39 insertions(+), 32 deletions(-) diff --git a/src/display.rs b/src/display.rs index 775d06f..b456734 100644 --- a/src/display.rs +++ b/src/display.rs @@ -40,7 +40,7 @@ fn fmt_thousands_sep(n: f64, sep: char) -> String { impl fmt::Display for Profiler { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { - Profiler::CacheGrind { + Profiler::Cachegrind { ref ir, ref i1mr, ref ilmr, @@ -100,7 +100,7 @@ impl fmt::Display for Profiler { Ok(()) } - Profiler::CallGrind { + Profiler::Callgrind { ref total_instructions, ref instructions, ref functs, diff --git a/src/main.rs b/src/main.rs index 984c37c..8beedba 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,9 +9,9 @@ pub mod profiler; use crate::argparse::{get_binary, get_profiler, get_sort_metric}; use crate::cargo::build_binary; use crate::err::ProfError; -use crate::parse::cachegrind::CacheGrindParser; -use crate::parse::callgrind::CallGrindParser; -use crate::profiler::Profiler; +use crate::parse::cachegrind::CachegrindParser; +use crate::parse::callgrind::CallgrindParser; +use crate::args::ProfilerType; use clap::{App, AppSettings, Arg, SubCommand}; use std::ffi::OsStr; use std::process; @@ -21,19 +21,26 @@ use anyhow::Result; fn main() -> Result<()> { let args = args::CargoProfilerConfig::from_args(); - dbg!(args); - // match args.profiler_type { - // Profiler::CallGrind { .. } => println!( - // "\n\x1b[1;33mProfiling \x1b[1;0m{} \x1b[0mwith callgrind\x1b[0m...", - // binary_name - // ), - // Profiler::CacheGrind { .. } => println!( - // "\n\x1b[1;33mProfiling \x1b[1;0m{} \x1b[0mwith cachegrind\x1b[0m...", - // binary_name - // ), - // }; - // + // The way cargo extension programs are meant to be written requires us to always have a + // variant here that is the only one that'll ever be usd. + let profiler_type = if let args::CargoProfilerConfig::Profiler { profiler_type } = args { + profiler_type + } else { + unreachable!(); + }; + + match profiler_type { + Profiler::Callgrind { .. } => println!( + "\n\x1b[1;33mProfiling \x1b[1;0m{} \x1b[0mwith callgrind\x1b[0m...", + binary_name + ), + Profiler::Cachegrind { .. } => println!( + "\n\x1b[1;33mProfiling \x1b[1;0m{} \x1b[0mwith cachegrind\x1b[0m...", + binary_name + ), + }; + // // parse arguments from cli call // let (m, profiler) = try_or_exit!(get_profiler(&matches)); // let binary = { diff --git a/src/parse/cachegrind.rs b/src/parse/cachegrind.rs index dce4db6..24301c1 100644 --- a/src/parse/cachegrind.rs +++ b/src/parse/cachegrind.rs @@ -33,7 +33,7 @@ pub fn sort_matrix(mat: &Array2, sort_col: ArrayView1) -> (Array2 /// Parser trait. To parse the output of Profilers, we first have to get their output from /// the command line, and then parse the output into respective structs. -pub trait CacheGrindParser { +pub trait CachegrindParser { fn cachegrind_cli(&self, binary: &str, binargs: &[&OsStr]) -> Result; fn cachegrind_parse<'b>( &'b self, @@ -43,7 +43,7 @@ pub trait CacheGrindParser { ) -> Result; } -impl CacheGrindParser for Profiler { +impl CachegrindParser for Profiler { /// Get profiler output from stdout. fn cachegrind_cli(&self, binary: &str, binargs: &[&OsStr]) -> Result { // get cachegrind cli output from stdout @@ -198,7 +198,7 @@ impl CacheGrindParser for Profiler { } // put all data in cachegrind struct! - Ok(Profiler::CacheGrind { + Ok(Profiler::Cachegrind { ir, i1mr, ilmr, diff --git a/src/parse/callgrind.rs b/src/parse/callgrind.rs index 88315ce..64211ab 100644 --- a/src/parse/callgrind.rs +++ b/src/parse/callgrind.rs @@ -7,12 +7,12 @@ use std::process::Command; // Parser trait. To parse the output of Profilers, we first have to get their output from // the command line, and then parse the output into respective structs. -pub trait CallGrindParser { +pub trait CallgrindParser { fn callgrind_cli(&self, binary: &str, binargs: &[&OsStr]) -> Result; fn callgrind_parse<'b>(&'b self, output: &'b str, num: usize) -> Result; } -impl CallGrindParser for Profiler { +impl CallgrindParser for Profiler { // Get profiler output from stdout. fn callgrind_cli(&self, binary: &str, binargs: &[&OsStr]) -> Result { // get callgrind cli output from stdout @@ -98,7 +98,7 @@ impl CallGrindParser for Profiler { funcs = funcs.iter().take(num).cloned().collect(); } // put all data in cachegrind struct! - Ok(Profiler::CallGrind { + Ok(Profiler::Callgrind { total_instructions, instructions: data_vec, functs: funcs, @@ -108,7 +108,7 @@ impl CallGrindParser for Profiler { #[cfg(test)] mod test { - use super::CallGrindParser; + use super::CallgrindParser; use crate::profiler::Profiler; #[test] fn test_callgrind_parse_1() { diff --git a/src/profiler.rs b/src/profiler.rs index 58134a0..39ff417 100644 --- a/src/profiler.rs +++ b/src/profiler.rs @@ -1,12 +1,12 @@ use ndarray::Array2; use std::f64; -// Profiler enum. We have two profilers: CacheGrind and CallGrind. +// Profiler enum. We have two profilers: Cachegrind and Callgrind. pub enum Profiler { - // CachGrind holds the parsed objects of + // Cachgrind holds the parsed objects of // `valgrind --tool=cachegrind -cachegrind-out-file=cachegrind.out // && cg_annotate cachegrind.out` - CacheGrind { + Cachegrind { ir: f64, i1mr: f64, ilmr: f64, @@ -23,7 +23,7 @@ pub enum Profiler { // Call holds the parsed objects of // `valgrind --tool=callgrind --callgrind-out-file=callgrind.out // && callgrind_annotate callgrind.out` - CallGrind { + Callgrind { total_instructions: f64, instructions: Vec, functs: Vec, @@ -32,10 +32,10 @@ pub enum Profiler { // Initialize the Profilers impl Profiler { - // Initialize CacheGrind + // Initialize Cachegrind pub fn new_cachegrind() -> Profiler { - Profiler::CacheGrind { + Profiler::Cachegrind { // total instructions ir: f64::NAN, // total instruction-cache read misses @@ -60,9 +60,9 @@ impl Profiler { functs: Vec::new(), } } - // Initialize CallGrind + // Initialize Callgrind pub fn new_callgrind() -> Profiler { - Profiler::CallGrind { + Profiler::Callgrind { // total instruction calls total_instructions: f64::NAN, // instruction data From 16d14e76589be504c264aa29265fc0a9d445fe74 Mon Sep 17 00:00:00 2001 From: Sven-Hendrik Haase Date: Mon, 4 Nov 2019 22:38:09 +0100 Subject: [PATCH 4/5] Bump some deps --- Cargo.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5b4936c..cbbca65 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,7 +18,7 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -44,7 +44,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "cargo-profiler" version = "1.1.0" dependencies = [ - "anyhow 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "anyhow 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "ndarray 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -80,7 +80,7 @@ name = "heck" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-segmentation 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -308,7 +308,7 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.3.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -348,7 +348,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -"checksum anyhow 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "ab335240fd942ab8191c5e628cd4ff3903c577bda961fb75df08e0303a00527b" +"checksum anyhow 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)" = "57114fc2a6cc374bce195d3482057c846e706d252ff3604363449695684d7a0d" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" "checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" @@ -383,7 +383,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7bedb3320d0f3035594b0b723c8a28d7d336a3eda3881db79e61d676fb644c" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" -"checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9" +"checksum unicode-segmentation 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49f5526225fd8b77342d5986ab5f6055552e9c0776193b5b63fd53b46debfad7" "checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20" "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" From 60fe10487cf8060a77474c82bf062bce27a10aea Mon Sep 17 00:00:00 2001 From: Sven-Hendrik Haase Date: Sun, 1 Mar 2020 07:45:01 +0100 Subject: [PATCH 5/5] WIP --- Cargo.lock | 216 ++++++++++++++++++++++++++++++++-------------------- src/args.rs | 8 +- src/main.rs | 4 +- 3 files changed, 138 insertions(+), 90 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5b4936c..3300fa0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5,7 +5,7 @@ name = "aho-corasick" version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -18,21 +18,22 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.18" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "atty" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "autocfg" -version = "0.1.7" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -44,14 +45,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "cargo-profiler" version = "1.1.0" dependencies = [ - "anyhow 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "ndarray 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "strum 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "strum_macros 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -62,11 +63,11 @@ version = "2.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -80,12 +81,20 @@ name = "heck" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "hermit-abi" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "itertools" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -93,7 +102,7 @@ dependencies = [ [[package]] name = "itoa" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -103,7 +112,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.65" +version = "0.2.66" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -116,7 +125,7 @@ dependencies = [ [[package]] name = "memchr" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -124,53 +133,67 @@ name = "ndarray" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "matrixmultiply 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "num-complex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "num-complex 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "rawpointer 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-complex" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-integer" -version = "0.1.41" +version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-traits" -version = "0.2.8" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "proc-macro-error" -version = "0.2.6" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-error-attr 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "rustversion 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "proc-macro-error-attr" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustversion 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn-mid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "proc-macro2" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -181,7 +204,7 @@ name = "quote" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -191,20 +214,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "regex" -version = "1.3.1" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.6.12" +version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rustversion" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ryu" version = "1.0.2" @@ -212,30 +245,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.102" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.102" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "1.0.41" +version = "1.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -245,23 +278,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "structopt" -version = "0.3.3" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt-derive 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt-derive 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "structopt-derive" -version = "0.3.3" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-error 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -275,32 +309,42 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "syn" -version = "1.0.7" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "syn-mid" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thread_local" -version = "0.3.6" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -308,12 +352,12 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.3.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "unicode-width" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -348,43 +392,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -"checksum anyhow 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "ab335240fd942ab8191c5e628cd4ff3903c577bda961fb75df08e0303a00527b" -"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" -"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" +"checksum anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)" = "7825f6833612eb2414095684fcf6c635becf3ce97fe48cf6421321e93bfbd53c" +"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +"checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" "checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" -"checksum itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "87fa75c9dea7b07be3138c49abbb83fd4bea199b5cdc76f9804458edc5da0d6e" -"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" +"checksum hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eff2656d88f158ce120947499e971d743c05dbcbed62e5bd2f38f1698bbc3772" +"checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" +"checksum itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "1a31a0627fdf1f6a39ec0dd577e101440b7db22672c0901fe00a9a6fbb5c24e8" +"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" "checksum matrixmultiply 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f7ec66360130972f34830bfad9ef05c6610a43938a467bcc9ab9369ab3478f" -"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" +"checksum memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3197e20c7edb283f87c071ddfc7a2cca8f8e0b888c242959846a6fce03c72223" "checksum ndarray 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "25b001fc2f5df269365fb77bd8396ce6b1f61c9848f7f088c25e57494bacc57b" -"checksum num-complex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fcb0cf31fb3ff77e6d2a6ebd6800df7fdcd106f2ad89113c9130bcd07f93dffc" -"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" -"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" -"checksum proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aeccfe4d5d8ea175d5f0e4a2ad0637e0f4121d63bd99d356fb1f39ab2e7c6097" -"checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27" +"checksum num-complex 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" +"checksum num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba" +"checksum num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096" +"checksum proc-macro-error 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1b79a464461615532fcc8a6ed8296fa66cc12350c18460ab3f4594a6cee0fcb6" +"checksum proc-macro-error-attr 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "23832e5eae6bac56bbac190500eef1aaede63776b5cd131eaa4ee7fe120cd892" +"checksum proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3acb317c6ff86a4e579dfa00fc5e6cca91ecbb4e7eb2df0468805b674eb88548" "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" "checksum rawpointer 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" -"checksum regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd" -"checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716" +"checksum regex 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b5508c1941e4e7cb19965abef075d35a9a8b5cdf0846f30b4050e9b55dc55e87" +"checksum regex-syntax 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e734e891f5b408a29efbf8309e656876276f49ab6a6ac208600b4419bd893d90" +"checksum rustversion 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b3bba175698996010c4f6dce5e7f173b6eb781fce25d2cfc45e27091ce0b79f6" "checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8" -"checksum serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4b39bd9b0b087684013a792c59e3e07a46a01d2322518d8a1104641a0b1be0" -"checksum serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)" = "ca13fc1a832f793322228923fbb3aba9f3f44444898f835d31ad1b74fa0a2bf8" -"checksum serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "2f72eb2a68a7dc3f9a691bfda9305a1c017a6215e5a4545c258500d2099a37c2" +"checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449" +"checksum serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64" +"checksum serde_json 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)" = "eab8f15f15d6c41a154c1b128a22f2dfabe350ef53c40953d84e36155c91192b" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum structopt 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4f66a4c0ddf7aee4677995697366de0749b0139057342eccbb609b12d0affc" -"checksum structopt-derive 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8fe0c13e476b4e21ff7f5c4ace3818b6d7bdc16897c31c73862471bc1663acae" +"checksum structopt 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "df136b42d76b1fbea72e2ab3057343977b04b4a2e00836c3c7c0673829572713" +"checksum structopt-derive 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd50a87d2f7b8958055f3e73a963d78feaccca3836767a9069844e34b5b03c0a" "checksum strum 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6138f8f88a16d90134763314e3fc76fa3ed6a7db4725d6acf9a3ef95a3188d22" "checksum strum_macros 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0054a7df764039a6cd8592b9de84be4bec368ff081d203a7d5371cbfa8e65c81" -"checksum syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7bedb3320d0f3035594b0b723c8a28d7d336a3eda3881db79e61d676fb644c" +"checksum syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "af6f3550d8dff9ef7dc34d384ac6f107e5d31c8f57d9f28e0081503f547ac8f5" +"checksum syn-mid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9fd3937748a7eccff61ba5b90af1a20dbf610858923a9192ea0ecb0cb77db1d0" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" -"checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9" -"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20" +"checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" +"checksum unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" +"checksum unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" "checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" diff --git a/src/args.rs b/src/args.rs index ba9d4dc..fe41e94 100644 --- a/src/args.rs +++ b/src/args.rs @@ -21,11 +21,11 @@ pub enum ProfilerType { Callgrind { /// Binary you want to profile #[structopt(name = "BIN", long)] - binary: Option, + binary_name: String, /// Arguments for the binary #[structopt(name = "ARG")] - bin_args: Vec, + binary_args: Vec, /// Build binary in release mode #[structopt(long)] @@ -43,11 +43,11 @@ pub enum ProfilerType { Cachegrind { /// Binary you want to profile #[structopt(name = "BIN", long)] - binary: Option, + binary_name: String, /// Arguments for the binary #[structopt(name = "ARG")] - bin_args: Vec, + binary_args: Vec, /// Build binary in release mode #[structopt(long)] diff --git a/src/main.rs b/src/main.rs index 8beedba..5584333 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,11 +31,11 @@ fn main() -> Result<()> { }; match profiler_type { - Profiler::Callgrind { .. } => println!( + ProfilerType::Callgrind { binary_name, .. } => println!( "\n\x1b[1;33mProfiling \x1b[1;0m{} \x1b[0mwith callgrind\x1b[0m...", binary_name ), - Profiler::Cachegrind { .. } => println!( + ProfilerType::Cachegrind { binary_name, .. } => println!( "\n\x1b[1;33mProfiling \x1b[1;0m{} \x1b[0mwith cachegrind\x1b[0m...", binary_name ),