From 03992752b17c54a789a0b0a89184d7170a67c9a1 Mon Sep 17 00:00:00 2001 From: "Federico G. Schwindt" Date: Fri, 6 Oct 2023 05:54:06 -0600 Subject: [PATCH] Add perfmap profiling strategy (#316) --- cli/src/opts.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cli/src/opts.rs b/cli/src/opts.rs index af43b63d..8dde4f6d 100644 --- a/cli/src/opts.rs +++ b/cli/src/opts.rs @@ -239,6 +239,7 @@ fn check_module(s: &str) -> Result { fn check_wasmtime_profiler_mode(s: &str) -> Result { match s { "jitdump" => Ok(ProfilingStrategy::JitDump), + "perfmap" => Ok(ProfilingStrategy::PerfMap), "vtune" => Ok(ProfilingStrategy::VTune), _ => Err(Error::ProfilingStrategy), } @@ -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 {