diff --git a/crox/src/main.rs b/crox/src/main.rs index 5cbf3eb..7cc6af9 100644 --- a/crox/src/main.rs +++ b/crox/src/main.rs @@ -46,6 +46,9 @@ struct Opt { /// collapse threads without overlapping events #[structopt(long = "collapse-threads")] collapse_threads: bool, + /// filter out events with shorter duration (in microseconds) + #[structopt(long = "minimum-duration")] + minimum_duration: u128, } // generate mapping from thread_id to collapsed thread_id or an empty map @@ -130,7 +133,9 @@ fn main() -> Result<(), Box> { // only handle startStop events for now if let MatchingEvent::StartStop(start, stop) = event { let duration = stop.timestamp.duration_since(start.timestamp).unwrap(); - + if duration.as_micros() < opt.minimum_duration { + continue; + } return Some(Event { name: start.label.clone().into_owned(), category: start.event_kind.clone().into_owned(),