Re: [RESEND PATCH V3 3/8] perf/x86/intel: Support hardware TopDown metrics

From: Liang, Kan
Date: Mon Sep 09 2019 - 09:40:31 EST




On 8/31/2019 5:19 AM, Peter Zijlstra wrote:
Then there is no mucking about with that odd counter/metrics msr pair
reset nonsense. Becuase that really stinks.
You have to write them to reset the internal counters.
But not for ever read, only on METRIC_OVF.

The precision are lost if the counters were running much longer than the measured delta. We have to reset the counters after every read.
For example, the worst case is:
The previous reading was rounded up and the current reading is rounded down. The error of METRICS is 1/256 - 1/SLOTS, which is related to SLOTS. The error for each Topdown event is (1/256 - 1/SLOTS) * SLOTS.
With the SLOTS increasing, the precision will get worse and worse.
Therefor, we have to reset the counters periodically.

Thanks,
Kan