Hi, I have a few traces where I have samples for kernel (and other processes), yet kernel is always 0 for any CPU Counter selected. There are other processes with an equivalent number of samples where the counter values appear.
Perhaps there is a bit of 'art' to get the kernel counters to populate?
I am trying to understand the workload from the system perspective (not simply the narrower process perspective), and it would be helpful to have the counter values. I've tried running for extended durations, yet that doesn't seem to adjust the counted events. I've adjusted to include "High Frequency Sampling" to resolve issues with VMware counter collection. Yet.. I need help to enable counter values to appear for kernel.
Sam
You're hitting a limitation of Instruments' focus on user space profiling. CORE_ACTIVE_CYCLE
is a configurable event (goes on a configurable counter) and Instruments filters those events to only increment in user space. The kernel doesn't have any threads that run in user space, so its CORE_ACTIVE_CYCLES
(and any other configurable counter counts, from other events) are recorded as 0.
To work around this for cycles specifically, you might try using the "Cycles (FIXED_CYCLE
)" event instead. That event is hosted on a fixed counter and is not subject to filtering based on kernel vs. user space execution. Note that this cannot be used as a sampling trigger (Instruments calls this "Sample By: Events"), however. And it only works for cycles or instructions; the other configurable events don't have fixed counters available.
It does seem useful for Instruments to allow counting the kernel here, so please file a feedback for that through https://developer.apple.com/bug-reporting/.
What was the VMWare counter collection issue you had to work around with high frequency sampling?