aperf/mperf

Andriy Gapon avg at freebsd.org
Fri Nov 19 15:45:36 UTC 2010


[looks like I originally sent the reply only privately]

on 19/11/2010 16:50 Daniel Nebdal said the following:
> On Fri, Nov 19, 2010 at 4:39 PM, Andriy Gapon <avg at freebsd.org> wrote:
>>
>> I am thinking about providing two APIs for this.
>>
>> 1. KPI
>> void cpu_get_a_m_perf(u_int cpu, uint64_t *aperf, uint64_t *mperf);
>>
>> 2. Userland
>> sysctl dev.cpu.N.aperf_mperf that returns two UQUAD values.
>>
>> But I am not sure where to put the code for both APIs.
>> Adding another device under cpu seems like an overkill.
>>
>> Ideas?
>> Thanks!
> 
> No comment on where to put it, but one other detail: Since these are
> measures since last reset, you probably want a similar
> "cpu_zero_a_m_perf" call. As for how that interacts with the sysctl,
> uhm ... maybe also offering a time-since-last-reset could be useful?
> 

I have something else in mind - no reset, but you call cpu_get_a_m_perf() twice,
take differences in the counters (accounting for possible overflows) and divide
those deltas.
In my opinion that should work.

-- 
Andriy Gapon


More information about the freebsd-current mailing list