Skip to content

Conversation

pavelsavara
Copy link
Member

@pavelsavara pavelsavara commented Mar 21, 2025

single-threaded sampling in EP - ep-rt-mono-runtime-provider.c

  • new should_record_sample() calculation about when to take next sample
  • method sample_current_thread_stack_trace without MonoContext * because in interp we don't have it
  • mono_wasm_instrument_method to disable the instrumentation. Could be some callspec in the future.

Fixes

  • fix mono_wasm_profiler_free_method condition
  • fix ep_session_free use-after-free in ST
  • fix INTERP_PROFILER_RAISE to not always create context
  • fix ep_rt_wait_event_free
  • fix profiler abort IP on jiterp
  • add LMF to profiler in interp and jiterp
  • MonoProfilerCallContext allocation feedback
  • const feedback

Flags

  • no need for WASM_PERFTRACING in rollup env
  • new runtime env variable to enable perf instrumentation DOTNET_WasmPerfInstrumentation, opt in via WasmPerfInstrumentation MSBuild property
  • disable MetricsSupport by default for browser

Testing: I'm doing manual testing with next PR which contains the JavaScript client. That's lot of TypeScript which would take attention away from C details in this PR. And so I split this PR as separate step.

Contributes to #76316
On top of #112352

@pavelsavara pavelsavara added arch-wasm WebAssembly architecture area-Diagnostics-mono os-browser Browser variant of arch-wasm labels Mar 21, 2025
@pavelsavara pavelsavara added this to the 10.0.0 milestone Mar 21, 2025
@pavelsavara pavelsavara self-assigned this Mar 21, 2025
@pavelsavara pavelsavara force-pushed the browser_ep_sampling branch from c1b4ef2 to 556f3b9 Compare March 21, 2025 13:30
- add LMF to profiler in interp and jiterp
Copy link
Member

@lateralusX lateralusX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly looked at the native code. Overall, it looks good, some comments are not actionable in this PR and I might convert them into issues later, but wanted to include them since this PR surface the underlying issues, other comments are more questions or checking assumptions and some are actually actionable :)

- session->refcount, ep_session_dec_ref, ep_session_inc_ref
- conditional default_profiler_sample_rate_in_nanoseconds and use of ep_sample_profiler_get_sampling_rate()
- don't register for MONO_PROFILER_CALL_INSTRUMENTATION_LEAVE and MONO_PROFILER_CALL_INSTRUMENTATION_TAIL_CALL
- inlining feedback for method_enter, method_samplepoint, method_exc_leave
- LMF feedback for mono_jiterp_prof_enter, mono_jiterp_prof_samplepoint, mono_jiterp_prof_leave
@pavelsavara pavelsavara requested a review from lateralusX March 27, 2025 11:02
Copy link
Member

@lateralusX lateralusX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes to native runtime code LGTM!

@pavelsavara
Copy link
Member Author

/ba-g CI timeouts

@pavelsavara pavelsavara merged commit eff415b into dotnet:main Mar 27, 2025
140 of 146 checks passed
@pavelsavara pavelsavara deleted the browser_ep_sampling branch March 27, 2025 14:53
@github-actions github-actions bot locked and limited conversation to collaborators Apr 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasm WebAssembly architecture area-Diagnostics-mono os-browser Browser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants