• Runzhen Wang's avatar
    perf tools: Make Power7 events available for perf · cfe0d8ba
    Runzhen Wang authored
    Power7 supports over 530 different perf events but only a small subset
    of these can be specified by name, for the remaining events, we must
    specify them by their raw code:
    
            perf stat -e r2003c <application>
    
    This patch makes all the POWER7 events available in sysfs.  So we can
    instead specify these as:
    
            perf stat -e 'cpu/PM_CMPLU_STALL_DFU/' <application>
    
    where PM_CMPLU_STALL_DFU is the r2003c in previous example.
    
    Before this patch is applied, the size of power7-pmu.o is:
    
    $ size arch/powerpc/perf/power7-pmu.o
       text	   data	    bss	    dec	    hex	filename
       3073	   2720	      0	   5793	   16a1	arch/powerpc/perf/power7-pmu.o
    
    and after the patch is applied, it is:
    
    $ size arch/powerpc/perf/power7-pmu.o
       text	   data	    bss	    dec	    hex	filename
      15950	  31112	      0	  47062	   b7d6	arch/powerpc/perf/power7-pmu.o
    
    For the run time overhead, I use two scripts, one is "event_name.sh",
    which contains 50 event names, it looks like:
    
     # ./perf record  -e 'cpu/PM_CMPLU_STALL_DFU/' -e .....  /bin/sleep 1
    
    the other one is named "event_code.sh" which use corresponding  events
    raw
    code instead of events names, it looks like:
    
     # ./perf record -e r2003c -e ......  /bin/sleep 1
    
    below is the result.
    
    Using events name:
    
    [root@localhost perf]# time ./event_name.sh
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.002 MB perf.data (~102 samples) ]
    
    real	0m1.192s
    user	0m0.028s
    sys	0m0.106s
    
    Using events raw code:
    
    [root@localhost perf]# time ./event_code.sh
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.003 MB perf.data (~112 samples) ]
    
    real	0m1.198s
    user	0m0.028s
    sys	0m0.105s
    Signed-off-by: default avatarRunzhen Wang <runzhen@linux.vnet.ibm.com>
    Acked-by: default avatarMichael Ellerman <michael@ellerman.id.au>
    Cc: icycoder@gmail.com
    Cc: linuxppc-dev@lists.ozlabs.org
    Cc: Michael Ellerman <michael@ellerman.id.au>
    Cc: Paul Mackerras <paulus@samba.org>
    Cc: Runzhen Wang <runzhew@clemson.edu>
    Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
    Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
    Link: http://lkml.kernel.org/r/1372407297-6996-3-git-send-email-runzhen@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    cfe0d8ba
power7-pmu.c 11.5 KB