> > > + 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 concept of tsc, avg and bzy are from turbostat. Here is the definition from turbostat readme. - AVG_MHz = APERF_delta/measurement_interval. This is the actual number of elapsed cycles divided by the entire sample interval - TSC_MHz = TSC_delta/measurement_interval. On a system with an invariant TSC, this value will be constant and will closely match the base frequency value - Bzy_MHz = TSC_delta/APERF_delta/MPERF_delta/measurement_interval Only the Bzy_MHz is wrong and has a typo error. Other formula should be correct.
If it's confusion, I will change the name and make it consistent as turbostat. > The right way to compute frequency is cycles / ref-cycles TSC can be used > to accurately compute CPU utilization tsc / ref-cycles I think I can add the support for frequency and CPU% calculation, and show them in --stdio. Thanks, Kan > > 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 majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/