Re: [PATCH v3] Clarify that exclude_kernel does not affect time_running
From: Alejandro Colomar <alx@kernel.org>
Date: 2025-02-06 07:19:09
Hi Cody, On Wed, Feb 05, 2025 at 02:56:03PM -0500, Cody Tapscott wrote:
Re-sending due to bad e-mail client settings that introduced artificial line wraps. My apologies for the confusion.
Thanks! No problem.
quoted hunk ↗ jump to hunk
Signed-off-by: Cody Tapscott <redacted> -- The man page recommends re-scaling event counts as (value * time_enabled / time_running), but does not mention that some time-filters (esp. exclude_kernel and exclude_user) do not affect the reported time_enabled or time_running, causing a very noisy estimate of the true event count. This limitation is easy to encounter when profiling events that are dominated by kernel (>= 50%) vs. user time and which are relatively short compared to the PMU muxing frequency (<~10x the period). In those cases, it is common to see (time_running / time_enabled) report, e.g., ~50% active time when perhaps almost none of the user time was actually spent with the counter running. --- man/man2/perf_event_open.2 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)diff --git a/man/man2/perf_event_open.2 b/man/man2/perf_event_open.2 index bcc6a39cb..bc22a3b12 100644 --- a/man/man2/perf_event_open.2 +++ b/man/man2/perf_event_open.2@@ -1063,9 +1063,22 @@ .SS Arguments .TP .I exclude_user If this bit is set, the count excludes events that happen in user space. +.IP +Note this does not affect the
I'd remove 'note', which is usually superfluous. Just start with 'This does not affect ...".
+.I time_running +or +.I time_enabled +fields, so enabling this may impact the reliability of the estimated total counts in the presence of multiplexing.
Sorry for not mentioning this. We also have 80-col right margin. So, you'll need to break this line, but at a phrase boundary. I'd break between 'of' and 'the', I think. I'd also break after the comma. fields, so enabling this may impact the reliability of the estimated total counts in the presence of multiplexing.
.TP .I exclude_kernel If this bit is set, the count excludes events that happen in kernel space. +.IP +Note this does not affect the
Same about 'note'.
quoted hunk ↗ jump to hunk
+.I time_running +or +.I time_enabled +fields, +so enabling this may impact the reliability of the estimated total counts in the presence of multiplexing. .TP .I exclude_hv If this bit is set, the count excludes events that happen in the@@ -1677,6 +1690,16 @@ .SS Reading results and .I time running values can be used to scale an estimated value for the count. +.IP +Note that for most events these values are not affected by
Same about 'note that'. Have a lovely day! Alex
+.IR exclude_hv , +.IR exclude_idle , +.IR exclude_user , +or +.I exclude_kernel +and, +if these are enabled, +the scaled estimate may be significantly less reliable in the presence of multiplexing. .TP .I value An unsigned 64-bit value containing the counter result. -- 2.34.1
-- <https://www.alejandro-colomar.es/>
Attachments
- signature.asc [application/pgp-signature] 833 bytes