Skip to content

Commit

Permalink
Add perfmap profiling strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
fgsch authored and Jake Champion committed Oct 6, 2023
1 parent 2e65140 commit 839bcc2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cli/src/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ fn check_module(s: &str) -> Result<String, Error> {
fn check_wasmtime_profiler_mode(s: &str) -> Result<ProfilingStrategy, Error> {
match s {
"jitdump" => Ok(ProfilingStrategy::JitDump),
"perfmap" => Ok(ProfilingStrategy::PerfMap),
"vtune" => Ok(ProfilingStrategy::VTune),
_ => Err(Error::ProfilingStrategy),
}
Expand Down Expand Up @@ -407,6 +408,21 @@ mod opts_tests {
}
}

/// Test that wasmtime's PerfMap profiling strategy is accepted.
#[test]
fn wasmtime_profiling_strategy_perfmap_is_accepted() -> TestResult {
let args = &[
"dummy-program-name",
"--profiler",
"perfmap",
&test_file("minimal.wat"),
];
match Opts::try_parse_from(args) {
Ok(_) => Ok(()),
res => panic!("unexpected result: {:?}", res),
}
}

/// Test that an invalid wasmtime's profiling strategy rejected.
#[test]
fn invalid_wasmtime_profiling_strategy_is_rejected() -> TestResult {
Expand Down

0 comments on commit 839bcc2

Please sign in to comment.