Messages in this thread | | | Date | Fri, 17 Jul 2015 13:25:53 -0700 | From | Andi Kleen <> | Subject | Re: [PATCH 8/9] perf,tools: caculate and save tsc/avg/bzy freq in he_stat |
| |
> + if (sample->read.time_running > 0) { > + freq.tsc_freq = (1000 * sample->tsc) / sample->read.time_running; > + freq.avg_freq = (1000 * sample->aperf) / sample->read.time_running; > + if (sample->aperf > 0) > + freq.bzy_freq = freq.tsc_freq * sample->mperf / sample->aperf;
Sorry didn't notice that earlier. The formula is not correct. aperf/mperf is not necessarily the frequency, it is essentially a load average of the CPU. It should be reported as such. Also only the ratio is architecturally defined.
The right way to compute frequency is cycles / ref-cycles TSC can be used to accurately compute CPU utilization tsc / ref-cycles
It would be useful to report all three metrics.
-Andi
| |