Skip to content

Commit d644083

Browse files
authored
Merge pull request #62 from andjo403/optional-minimum-duration
make minimum_duration optional in crox
2 parents 7dba6c5 + 2bd753d commit d644083

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

crox/src/main.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct Opt {
4848
collapse_threads: bool,
4949
/// filter out events with shorter duration (in microseconds)
5050
#[structopt(long = "minimum-duration")]
51-
minimum_duration: u128,
51+
minimum_duration: Option<u128>,
5252
}
5353

5454
// generate mapping from thread_id to collapsed thread_id or an empty map
@@ -133,8 +133,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
133133
// only handle startStop events for now
134134
if let MatchingEvent::StartStop(start, stop) = event {
135135
let duration = stop.timestamp.duration_since(start.timestamp).unwrap();
136-
if duration.as_micros() < opt.minimum_duration {
137-
continue;
136+
if let Some(minimum_duration) = opt.minimum_duration {
137+
if duration.as_micros() < minimum_duration {
138+
continue;
139+
}
138140
}
139141
return Some(Event {
140142
name: start.label.clone().into_owned(),

0 commit comments

Comments
 (0)