> +     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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to