From 5cddf13ce6bcafd39dcaebd3e3eaa5645e2f3364 Mon Sep 17 00:00:00 2001 From: klensy Date: Thu, 7 Mar 2024 11:51:40 +0300 Subject: [PATCH 1/3] fix unused import --- analyzeme/src/testing_common.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/analyzeme/src/testing_common.rs b/analyzeme/src/testing_common.rs index a31ac81..8d01208 100644 --- a/analyzeme/src/testing_common.rs +++ b/analyzeme/src/testing_common.rs @@ -2,7 +2,6 @@ use crate::{Event, EventPayload, ProfilingData, Timestamp}; use measureme::{EventId, EventIdBuilder, Profiler, StringId}; use rustc_hash::FxHashMap; use std::borrow::Cow; -use std::default::Default; use std::path::{Path, PathBuf}; use std::sync::Arc; use std::time::SystemTime; From 5553fba882f8ac4b9fcc7e1e4f1655e74c4cd85d Mon Sep 17 00:00:00 2001 From: klensy Date: Thu, 7 Mar 2024 12:11:59 +0300 Subject: [PATCH 2/3] fix clap 3.2 deprecated warnings $ cargo check --features clap/deprecated warning: use of deprecated method `clap::Arg::<'help>::required_unless`: Replaced with `Arg::required_unless_present` --> crox\src\main.rs:47:12 | 47 | #[clap(required_unless = "dir")] | ^^^^^^^^^^^^^^^ | = note: `#[warn(deprecated)]` on by default warning: use of deprecated method `clap::Arg::<'help>::required_unless`: Replaced with `Arg::required_unless_present` --> crox\src\main.rs:47:12 | 47 | #[clap(required_unless = "dir")] | ^^^^^^^^^^^^^^^ warning: use of deprecated associated function `clap::Parser::from_args`: `StructOpt::from_args` is replaced with `Parser::parse` (note the change in derives) --> crox\src\main.rs:138:20 | 138 | let opt = Opt::from_args(); | ^^^^^^^^^ warning: use of deprecated associated function `clap::Parser::from_args`: `StructOpt::from_args` is replaced with `Parser::parse` (note the change in derives) --> mmview\src\main.rs:17:20 | 17 | let opt = Opt::from_args(); | ^^^^^^^^^ | = note: `#[warn(deprecated)]` on by default warning: use of deprecated associated function `clap::Parser::from_args`: `StructOpt::from_args` is replaced with `Parser::parse` (note the change in derives) --> stack_collapse\src\main.rs:15:20 | 15 | let opt = Opt::from_args(); | ^^^^^^^^^ | = note: `#[warn(deprecated)]` on by default warning: use of deprecated associated function `clap::Parser::from_args`: `StructOpt::from_args` is replaced with `Parser::parse` (note the change in derives) --> mmedit\src\main.rs:64:20 | 64 | let opt = Opt::from_args(); | ^^^^^^^^^ | = note: `#[warn(deprecated)]` on by default warning: `crox` (bin "crox") generated 3 warnings warning: `mmview` (bin "mmview") generated 1 warning warning: `stack_collapse` (bin "stack_collapse") generated 1 warning warning: `mmedit` (bin "mmedit") generated 1 warning warning: use of deprecated associated function `clap::Parser::from_args`: `StructOpt::from_args` is replaced with `Parser::parse` (note the change in derives) --> flamegraph\src\main.rs:16:20 | 16 | let opt = Opt::from_args(); | ^^^^^^^^^ | = note: `#[warn(deprecated)]` on by default warning: `flamegraph` (bin "flamegraph") generated 1 warning warning: use of deprecated associated function `clap::Parser::from_args`: `StructOpt::from_args` is replaced with `Parser::parse` (note the change in derives) --> summarize\src\main.rs:315:20 | 315 | let opt = Opt::from_args(); | ^^^^^^^^^ | = note: `#[warn(deprecated)]` on by default --- crox/src/main.rs | 4 ++-- flamegraph/src/main.rs | 2 +- mmedit/src/main.rs | 2 +- mmview/src/main.rs | 2 +- stack_collapse/src/main.rs | 2 +- summarize/src/main.rs | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crox/src/main.rs b/crox/src/main.rs index 5f756a0..14f113d 100644 --- a/crox/src/main.rs +++ b/crox/src/main.rs @@ -44,7 +44,7 @@ struct Event { #[derive(Parser, Debug)] struct Opt { - #[clap(required_unless = "dir")] + #[clap(required_unless_present = "dir")] file_prefix: Vec, /// all event trace files in dir will be merged to one chrome_profiler.json file #[clap(long = "dir")] @@ -135,7 +135,7 @@ fn get_args(full_event: &analyzeme::Event<'_>) -> Option Result<(), Box> { - let opt = Opt::from_args(); + let opt = Opt::parse(); let chrome_file = BufWriter::new(fs::File::create("chrome_profiler.json")?); let mut serializer = serde_json::Serializer::new(chrome_file); diff --git a/flamegraph/src/main.rs b/flamegraph/src/main.rs index 847a6ef..7e9a236 100644 --- a/flamegraph/src/main.rs +++ b/flamegraph/src/main.rs @@ -13,7 +13,7 @@ struct Opt { } fn main() -> Result<(), Box> { - let opt = Opt::from_args(); + let opt = Opt::parse(); let profiling_data = ProfilingData::new(&opt.file_prefix)?; diff --git a/mmedit/src/main.rs b/mmedit/src/main.rs index 2c1758d..f27821f 100644 --- a/mmedit/src/main.rs +++ b/mmedit/src/main.rs @@ -61,7 +61,7 @@ fn truncate(file_contents: &[u8]) -> Result, Box Result<(), Box> { - let opt = Opt::from_args(); + let opt = Opt::parse(); match opt { Opt::Truncate(opt) => { diff --git a/mmview/src/main.rs b/mmview/src/main.rs index 1e2cfe4..ea71217 100644 --- a/mmview/src/main.rs +++ b/mmview/src/main.rs @@ -14,7 +14,7 @@ struct Opt { } fn main() -> Result<(), Box> { - let opt = Opt::from_args(); + let opt = Opt::parse(); let data = ProfilingData::new(&opt.file_prefix)?; diff --git a/stack_collapse/src/main.rs b/stack_collapse/src/main.rs index 86bcd1a..e243c92 100644 --- a/stack_collapse/src/main.rs +++ b/stack_collapse/src/main.rs @@ -12,7 +12,7 @@ struct Opt { } fn main() -> Result<(), Box> { - let opt = Opt::from_args(); + let opt = Opt::parse(); let profiling_data = ProfilingData::new(&opt.file_prefix)?; diff --git a/summarize/src/main.rs b/summarize/src/main.rs index ce98d3a..2b2af55 100644 --- a/summarize/src/main.rs +++ b/summarize/src/main.rs @@ -312,7 +312,7 @@ fn summarize(opt: SummarizeOpt) -> Result<(), Box> { } fn main() -> Result<(), Box> { - let opt = Opt::from_args(); + let opt = Opt::parse(); match opt { Opt::Summarize(opt) => summarize(opt), From c1be7ed0e0a61d282940c44e009a64d1d7722a90 Mon Sep 17 00:00:00 2001 From: klensy Date: Thu, 7 Mar 2024 12:58:11 +0300 Subject: [PATCH 3/3] fix clap 4 deprecated warnings $ cargo check --features clap/deprecated warning: use of deprecated function `::augment_args::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[arg(...)]` --> crox\src\main.rs:47:7 | 47 | #[clap(required_unless_present = "dir")] | ^^^^ | = note: `#[warn(deprecated)]` on by default warning: use of deprecated function `::augment_args::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[arg(...)]` --> crox\src\main.rs:50:7 | 50 | #[clap(long = "dir")] | ^^^^ warning: use of deprecated function `::augment_args::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[arg(...)]` --> crox\src\main.rs:53:7 | 53 | #[clap(long = "collapse-threads")] | ^^^^ warning: use of deprecated function `::augment_args::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[arg(...)]` --> crox\src\main.rs:56:7 | 56 | #[clap(long = "minimum-duration")] | ^^^^ warning: use of deprecated function `::augment_args::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[arg(...)]` --> mmview\src\main.rs:12:7 | 12 | #[clap(short = 't', long = "thread-id")] | ^^^^ | = note: `#[warn(deprecated)]` on by default warning: `crox` (bin "crox") generated 4 warnings warning: `mmview` (bin "mmview") generated 1 warning warning: use of deprecated function `::augment_subcommands::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[command(...)]` --> mmedit\src\main.rs:15:7 | 15 | #[clap(name = "truncate")] | ^^^^ | = note: `#[warn(deprecated)]` on by default warning: `mmedit` (bin "mmedit") generated 1 warning warning: use of deprecated function `::augment_args::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[arg(...)]` --> summarize\src\main.rs:28:7 | 28 | #[clap(short = 'e', long = "exclude")] | ^^^^ | = note: `#[warn(deprecated)]` on by default warning: use of deprecated function `::augment_args::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[arg(...)]` --> summarize\src\main.rs:31:7 | 31 | #[clap(long = "json")] | ^^^^ warning: use of deprecated function `::augment_args::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[arg(...)]` --> summarize\src\main.rs:40:7 | 40 | #[clap(long = "json")] | ^^^^ warning: use of deprecated function `::augment_args::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[arg(...)]` --> summarize\src\main.rs:44:7 | 44 | #[clap(short = 'p', long = "percent-above", default_value = "0.0")] | ^^^^ warning: use of deprecated function `::augment_subcommands::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[command(...)]` --> summarize\src\main.rs:51:7 | 51 | #[clap(name = "aggregate")] | ^^^^ warning: use of deprecated function `::augment_subcommands::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[command(...)]` --> summarize\src\main.rs:54:7 | 54 | #[clap(name = "diff")] | ^^^^ warning: use of deprecated function `::augment_subcommands::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[command(...)]` --> summarize\src\main.rs:58:7 | 58 | #[clap(name = "summarize")] | ^^^^ --- crox/Cargo.toml | 2 +- crox/src/main.rs | 8 ++++---- flamegraph/Cargo.toml | 2 +- mmedit/Cargo.toml | 2 +- mmedit/src/main.rs | 2 +- mmview/Cargo.toml | 2 +- mmview/src/main.rs | 2 +- stack_collapse/Cargo.toml | 2 +- summarize/Cargo.toml | 2 +- summarize/src/main.rs | 14 +++++++------- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/crox/Cargo.toml b/crox/Cargo.toml index 02259a5..2cbfe15 100644 --- a/crox/Cargo.toml +++ b/crox/Cargo.toml @@ -10,4 +10,4 @@ analyzeme = { path = "../analyzeme" } rustc-hash = "1.0.1" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -clap = { version = "3.2", features = ["derive"] } +clap = { version = "4.5.0", features = ["derive"] } diff --git a/crox/src/main.rs b/crox/src/main.rs index 14f113d..f4063a1 100644 --- a/crox/src/main.rs +++ b/crox/src/main.rs @@ -44,16 +44,16 @@ struct Event { #[derive(Parser, Debug)] struct Opt { - #[clap(required_unless_present = "dir")] + #[arg(required_unless_present = "dir")] file_prefix: Vec, /// all event trace files in dir will be merged to one chrome_profiler.json file - #[clap(long = "dir")] + #[arg(long = "dir")] dir: Option, /// collapse threads without overlapping events - #[clap(long = "collapse-threads")] + #[arg(long = "collapse-threads")] collapse_threads: bool, /// filter out events with shorter duration (in microseconds) - #[clap(long = "minimum-duration")] + #[arg(long = "minimum-duration")] minimum_duration: Option, } diff --git a/flamegraph/Cargo.toml b/flamegraph/Cargo.toml index 4a4a6f1..439c0a9 100644 --- a/flamegraph/Cargo.toml +++ b/flamegraph/Cargo.toml @@ -11,5 +11,5 @@ license = "MIT OR Apache-2.0" [dependencies] measureme = { path = "../measureme" } analyzeme = { path = "../analyzeme" } -clap = { version = "3.2", features = ["derive"] } +clap = { version = "4.5.0", features = ["derive"] } inferno = { version = "0.11", default-features = false } diff --git a/mmedit/Cargo.toml b/mmedit/Cargo.toml index 181e077..d51590b 100644 --- a/mmedit/Cargo.toml +++ b/mmedit/Cargo.toml @@ -6,4 +6,4 @@ edition = "2018" [dependencies] measureme = { path = "../measureme" } decodeme = { path = "../decodeme" } -clap = { version = "3.2", features = ["derive"] } +clap = { version = "4.5.0", features = ["derive"] } diff --git a/mmedit/src/main.rs b/mmedit/src/main.rs index f27821f..5cdb784 100644 --- a/mmedit/src/main.rs +++ b/mmedit/src/main.rs @@ -12,7 +12,7 @@ struct TruncateOpt { #[derive(Parser, Debug)] enum Opt { /// Truncate to a single page per tag - #[clap(name = "truncate")] + #[command(name = "truncate")] Truncate(TruncateOpt), } diff --git a/mmview/Cargo.toml b/mmview/Cargo.toml index 5f6c2a3..8e0b541 100644 --- a/mmview/Cargo.toml +++ b/mmview/Cargo.toml @@ -8,4 +8,4 @@ license = "MIT OR Apache-2.0" [dependencies] analyzeme = { path = "../analyzeme" } measureme = { path = "../measureme" } -clap = { version = "3.2", features = ["derive"] } +clap = { version = "4.5.0", features = ["derive"] } diff --git a/mmview/src/main.rs b/mmview/src/main.rs index ea71217..79989f9 100644 --- a/mmview/src/main.rs +++ b/mmview/src/main.rs @@ -9,7 +9,7 @@ struct Opt { file_prefix: PathBuf, /// Filter to events which occured on the specified thread id - #[clap(short = 't', long = "thread-id")] + #[arg(short = 't', long = "thread-id")] thread_id: Option, } diff --git a/stack_collapse/Cargo.toml b/stack_collapse/Cargo.toml index fbf3db4..d5f3d66 100644 --- a/stack_collapse/Cargo.toml +++ b/stack_collapse/Cargo.toml @@ -8,4 +8,4 @@ license = "MIT OR Apache-2.0" [dependencies] measureme = { path = "../measureme" } analyzeme = { path = "../analyzeme" } -clap = { version = "3.2", features = ["derive"] } +clap = { version = "4.5.0", features = ["derive"] } diff --git a/summarize/Cargo.toml b/summarize/Cargo.toml index 8b58a3c..74c4c63 100644 --- a/summarize/Cargo.toml +++ b/summarize/Cargo.toml @@ -12,4 +12,4 @@ prettytable-rs = "0.10" rustc-hash = "1.0.1" serde = { version = "1.0", features = [ "derive" ] } serde_json = "1.0" -clap = { version = "3.2", features = ["derive"] } +clap = { version = "4.5.0", features = ["derive"] } diff --git a/summarize/src/main.rs b/summarize/src/main.rs index 2b2af55..9c3ce65 100644 --- a/summarize/src/main.rs +++ b/summarize/src/main.rs @@ -25,10 +25,10 @@ struct DiffOpt { base: PathBuf, change: PathBuf, - #[clap(short = 'e', long = "exclude")] + #[arg(short = 'e', long = "exclude")] exclude: Vec, - #[clap(long = "json")] + #[arg(long = "json")] json: bool, } @@ -37,25 +37,25 @@ struct SummarizeOpt { file_prefix: PathBuf, /// Writes the analysis to a json file next to instead of stdout - #[clap(long = "json")] + #[arg(long = "json")] json: bool, /// Filter the output to items whose self-time is greater than this value - #[clap(short = 'p', long = "percent-above", default_value = "0.0")] + #[arg(short = 'p', long = "percent-above", default_value = "0.0")] percent_above: f64, } #[derive(Parser, Debug)] enum Opt { /// Processes a set of trace files with identical events and analyze variance - #[clap(name = "aggregate")] + #[command(name = "aggregate")] Aggregate(AggregateOpt), - #[clap(name = "diff")] + #[command(name = "diff")] Diff(DiffOpt), /// Processes trace files and produces a summary - #[clap(name = "summarize")] + #[command(name = "summarize")] Summarize(SummarizeOpt), }