I address you in order to solve the following doubt I have while analyzing some data provided by Vtune 7.0. Currently I am doing some performance analysis on an application that does not make a heavy use of the CPU but it performs quite a large number of file I/O operations.
My Vtune project contains both a counter monitor and a sampling analysis. I am only interested in CPU use of my application so I focus in % Processor time and clock ticks events. These are the results I obtain in both cases:
Average % Processor time = 1.5 %.
Std deviation = 1.7
- System Idle Process:
Average % Processor time = 94.5 %.
Std deviation = 5.4.
- MyApp.exe : 244 clock ticks samples.
7.27 % of totat.
- System Idle Process : 1157 clock ticks samples .
34.48 % of total.
Could you give me some hint in order to understand why the CPU is busy 94.5% of the time (counter monitor analysis) with the Idle process but on the other hand it only consumes 34.48% of the clock ticks (sampling analysis) for that process?. For what I understand in the documentation, the clock ticks event also includes the clock ticks for which the CPU is halted.
Something to look into would be the fact that the newer processors, i.e., those with HyperThreading technology, can put the processor to "sleep" under certain conditions. There are now two different "clockticks" events and one of them doesn't increment when the processor is asleep. Check out "Non-halted Clockticks" and "Non-sleep Clockticks" in the VTune analyzer online help.
Another way to investigate, and I've seen this used here, is to write a low-priority application that sits in a loop and, basically, consumes all unused cycles. That way, the processor never halts or goes to sleep, and any unused cycles should collect samples within this low priority application.
Finally, be careful of the way the analyzer reports sampling data. When viewing a module, the percentage is percentage of total samples, but when viewing hotspots in a module, the percentage is percentage of samples collected in that module. Also, depending on how you get to the Modules view (i.e. from Process, Thread, or initial display), it may change.