KEMBAR78
Count missed samples when estimating total CPU time in ctimer mode by apangin · Pull Request #1068 · async-profiler/async-profiler · GitHub
Skip to content

Conversation

apangin
Copy link
Member

@apangin apangin commented Nov 29, 2024

Description

Leverage si_overrun for scaling total CPU time counted in ctimer mode.

Motivation and context

Sampling frequency in ctimer mode depends on the kernel CONFIG_HZ configuration, which is typically 250 or 100 Hz. This means, profiling intervals should be multiple of 4ms/10ms, or they will not work as expected.

Fortunately, if profiling interval is set to a smaller value, Linux will pass the number of missed samples (number of times the timer would have triggered) in si_overrun field of siginfo. We can use this value to compute actual CPU time.

How has this been tested?

Usual tests + new ctimerTotal and itimerTotal unit tests.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@apangin apangin merged commit 6993349 into master Nov 30, 2024
10 checks passed
@apangin apangin deleted the timer-overrun branch November 30, 2024 21:58
krk pushed a commit to krk/async-profiler that referenced this pull request Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant