Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add perfmap profiling strategy #316

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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