Skip to content

Commit f4ca287

Browse files
authored
Merge pull request #49 from wesleywiser/diag
[mmview] Add a thread-id filter argument
2 parents bb14545 + f63d98e commit f4ca287

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Unreleased
44
### Added
55
- `measureme`: Added support for compiling the library under wasm/wasi ([GH-43])
6+
- `mmview`: Added the `-t` flag to limit output to results on the specified thread id ([GH-49])
67

78
## [0.3.0] - 2019-05-14
89
### Added
@@ -23,3 +24,4 @@
2324
[GH-35]: https://github.com/rust-lang/measureme/pull/35
2425
[GH-41]: https://github.com/rust-lang/measureme/pull/41
2526
[GH-43]: https://github.com/rust-lang/measureme/pull/43
27+
[GH-49]: https://github.com/rust-lang/measureme/pull/49

mmview/src/main.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ use structopt::StructOpt;
77
#[derive(StructOpt, Debug)]
88
struct Opt {
99
file_prefix: PathBuf,
10+
11+
/// Filter to events which occured on the specified thread id
12+
#[structopt(short = "t", long = "thread-id")]
13+
thread_id: Option<u64>,
1014
}
1115

1216
fn main() -> Result<(), Box<dyn Error>> {
@@ -15,6 +19,12 @@ fn main() -> Result<(), Box<dyn Error>> {
1519
let data = ProfilingData::new(&opt.file_prefix)?;
1620

1721
for event in data.iter() {
22+
if let Some(thread_id) = opt.thread_id {
23+
if event.thread_id != thread_id {
24+
continue;
25+
}
26+
}
27+
1828
println!("{:?}", event);
1929
}
2030

summarize/src/analysis.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ pub fn perform_analysis(data: ProfilingData) -> Results {
147147
let thread_stack = threads.get_mut(&event.thread_id).unwrap();
148148
let start_event = thread_stack.pop().unwrap();
149149

150-
assert_eq!(start_event.event_kind, event.event_kind);
151150
assert_eq!(start_event.label, event.label);
151+
assert_eq!(start_event.event_kind, event.event_kind);
152152
assert_eq!(start_event.timestamp_kind, TimestampKind::Start);
153153

154154
//track the time for this event

0 commit comments

Comments
 (0)