Hi

I want to use/read the PMU counters for 'instructions' and 'cycles',
from within the kernel, to measure the overhead of different in-kernel
functions (and calc the pipeline efficiency ala perf-stat insns per cycle).

What is the prefered way/API to read these counters, without
conflicting with the perf tool?


I've already looked at Andi Kleens "simple-pmu" kernel module
 https://github.com/andikleen/simple-pmu/
Thus, I have figured out how I can hack this together open-coded. I'm
looking for advice on howto use the existing perf APIs ?

I basically just need a in-kernel API to turn in these counters, and
then I can just read them via the rdpcm instruction.


Info I already learned (correct me if I'm wrong):

The 'instructions' counter is the "Instruction Retired" counter
 * Event num: 0xC0, Umask: 0x00
 * Read via rdpmc 0x40000000

The 'cycles' counter is the "Unhalted core cycles" counter
 * Event num: 0x3C, Umask: 0x00
 * Read via rdpmc 0x40000001

I'm uncertain about the rdpmc hex values (taken from simple-pmu).

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Sr. Network Kernel Developer at Red Hat
  Author of http://www.iptv-analyzer.org
  LinkedIn: http://www.linkedin.com/in/brouer
--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to