2

I'm counting events with perf stat -e. I consulted my processor manufacturer's manual and found the event I'm interested in.

However, not only does it have the event number, but it also has a list of unit masks and their descriptions. What are they and how do I indicate to perf which I want? I know how to measure an event, but I don't know how to use unit masks.

Update: here's the description from the manual:

NBPMCx1E0 CPU to DRAM Requests to Target Node

This event counts all DRAM reads and writes generated by cores on the local node to the targeted node in the coherent fabric. This counter can be used to observe processor data affinity in NUMA aware operating systems.

UnitMask    Description
7           From Local node to Node 7
6           From Local node to Node 6
5           From Local node to Node 5
4           From Local node to Node 4
3           From Local node to Node 3
2           From Local node to Node 2
1           From Local node to Node 1
0           From Local node to Node 0
0

I believe this is part of your answer here in the IBM articled titled: Evaluate performance for Linux on POWER.

One drawback is that, although it allows gathering of hardware performance counters directly, perf does not recognize the counter name denoted by the POWER7 CBM; it needs to use raw hexadecimal numbers instead. Table 1 is a mapping of OProfile events to hexadecimal numbers which you can use with perf (using the record raw events options) to utilize the CBM for POWER7.

I cannot tell however if this is a limitation of POWER or of perf.

Example run

I took the sample perf command from that article and modified it slightly so that it just ran the command ls.

$ sudo perf stat -C 0 -e \
r100f2,r4001a,r100f8,r4001c,r2001a,r200f4,r2004a,r4004a,r4004e,r4004c,\
r20016,r40018,r20012,r40016,r40012,r20018,r4000a,r2001c,r1001c,r20014,\
r40014,r30004 taskset -c 0 ls
Pharrell Williams - Happy (Official Music Video)-y6Sxv-sUYtM.mp3

 Performance counter stats for 'taskset -c 0 ls':

                 0 r100f2                                                       [16.55%]
                 0 r4001a                                                       [19.54%]
                 0 r100f8                                                       [22.86%]
                 0 r4001c                                                       [25.97%]
                 0 r2001a                                                       [25.92%]
                 0 r200f4                                                       [26.00%]
                 0 r2004a                                                       [25.77%]
                 0 r4004a                                                       [25.83%]
                 0 r4004e                                                       [25.56%]
                 0 r4004c                                                       [22.45%]
                 0 r20016                                                       [19.25%]
                 0 r40018                                                       [16.15%]
                 0 r20012                                                       [12.97%]
                 0 r40016                                                       [12.98%]
                 0 r40012                                                       [12.97%]
                 0 r20018                                                       [13.02%]
                 0 r4000a                                                       [13.03%]
                 0 r2001c                                                       [12.96%]
                 0 r1001c                                                       [13.10%]
                 0 r20014                                                       [13.00%]
                 0 r40014                                                       [13.07%]
                 0 r30004                                                       [13.08%]

       0.030559857 seconds time elapsed
  • I think I didn't make myself clear on my question. I know how to measure an event, what I'm interested in are the unit masks. – iomartin Feb 17 '14 at 23:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.