[release/6.0] Always write sample events in EventPipe based on sample frequency....
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Wed, 8 Sep 2021 17:39:13 +0000 (10:39 -0700)
committerGitHub <noreply@github.com>
Wed, 8 Sep 2021 17:39:13 +0000 (10:39 -0700)
commitef046aa65fd26bdb61af14a6f69456f6e107b570
tree021b3ba8d1e9db4dc10da32345b5411f5f47ca23
parent66c228e51827b91434fbb899fb413201d27cc1b6
[release/6.0] Always write sample events in EventPipe based on sample frequency. (#58761)

* Always write sample events in EventPipe based on sample frequency.

If no managed frames (including helper frames) are located on stack,
sample was dropped and not emitted into EventPipe. This cause issues
in tooling that try to do thread time calculations based on sample,
especially in cases where embedded threads returned to native
code during several samples before calling back into runtime. In such
scenarios the last sampled event would be prolonged, giving false
information that that stackframe lasted much longer than it really did.

Always writing samples into EventPipe will also visualize time an attached
thread spend outside of runtime, not running managed code.

* Adjust included profiler samples.

Only include external samples still on top fram (no callstack) or
managed/external samples includig a callstack.

Co-authored-by: lateralusX <lateralusx.github@gmail.com>
src/mono/mono/eventpipe/ep-rt-mono.c