Skip to content

Conversation

@rtb-12
Copy link
Contributor

@rtb-12 rtb-12 commented Dec 31, 2025

[Runtime] Add Wasmer PerfMap Profiling for WASM Stack Traces in Flamegraphs

Description

Adds Wasmer PerfMap profiling to show WASM function names in CPU flamegraphs instead of [perf-<PID>.map] entries. This enables symbolization of JIT-compiled WASM code during profiling.

Changes:

  • Added wasmer-compiler-cranelift as optional dependency with profiling feature
  • Configured Wasmer engine to use PerfMap profiler when ENABLE_WASMER_PROFILING=true
  • Added perf.map file preservation/restoration logic in profiling scripts
  • Added monitoring to verify perf.map file generation
  • Updated build configuration to enable profiling feature for profiling binaries

Dependencies:

  • wasmer-compiler-cranelift = "4.2.5" (optional, only for profiling builds)
  • Profiling feature flag: calimero-runtime/profiling

Test Plan

CI Testing:

  • Updated fuzzy-load-test.yml to run on PRs with 5-minute duration (temporary for testing)
  • TODO: REVERT duration back to 45 minutes before PR merge
  • Profiling workflow will automatically test with Wasmer PerfMap enabled
  • Verify flamegraphs in CI artifacts show WASM function names

Documentation Update


Note

Introduces PerfMap-based WASM stack symbolization and upgrades Wasmer across the workspace.

  • Upgrade wasmer to 6.1.0 and add optional wasmer-compiler-cranelift; update runtime to new wasmer::sys APIs
  • New profiling feature in calimero-runtime and calimero-context; runtime uses Cranelift and enable_perfmap() when ENABLE_WASMER_PROFILING=true
  • Map TrapCode::UncaughtException and set tunables only for sys engines
  • Profiling Docker image and scripts now preserve/restore perf-<pid>.map for WASM symbolization; flamegraph generation restored from saved maps
  • CI: release builds profiling binaries with calimero-context/profiling; fuzzy load tests trigger on PRs and temporarily run for 5 minutes; image tag logic extends wait time for profiling builds

Written by Cursor Bugbot for commit fc9df34. This will update automatically on new commits. Configure here.

…filing capabilities

- Added  dependency to Cargo.toml and Cargo.lock.
- Updated profiling scripts to support Wasmer PerfMap for WASM stack traces.
- Enhanced engine creation logic to enable profiling when the feature is activated.
- Preserved  files for JIT code symbolization during profiling.
…and adjust test duration for testing purposes
- Changed the feature reference in the release workflow from `calimero-runtime/profiling` to `calimero-context/profiling`.
- Added a new profiling feature in `Cargo.toml` for the `calimero-context` crate.
@github-actions
Copy link

SDK JS Workflows Failed

The following SDK JS workflow(s) failed:

  • examples/kv-store/workflows/simple-store-js.yml

Please check the workflow logs for more details.

- Upgraded Wasmer and related packages to version 6.1.0 in Cargo.toml and Cargo.lock.
- Improved profiling scripts for better monitoring of perf.map file generation.
- Added support for new dependencies and updated existing ones to ensure compatibility.
- Enhanced error handling in runtime for uncaught exceptions in WASM traps.
- Adjusted MAX_WAIT duration to 30 minutes for profiling containers and 20 minutes for standard containers.
- Added conditional logic to handle profiling mode, improving build efficiency for profiling workflows.
@github-actions
Copy link

Merobox Proposals Workflows Failed

The following proposal workflow(s) failed:

  • near
  • icp
  • ethereum

Please check the workflow logs for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants