Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save styxyang/8491060c5b66b7d4aa9c to your computer and use it in GitHub Desktop.
Save styxyang/8491060c5b66b7d4aa9c to your computer and use it in GitHub Desktop.
Xen vPMU filter testing

Testing of Xen vPMU filter options.

Three tests are executed on a simple program (noploop, which runs NOP in a loop). The first two show Linux "perf stat" summaries, and the third tests specific counters: the IPC ones, an architectural one, and a few extras. Which of these will work depends on the filter mode.

I'll begin by showing off and on, the current modes, and then the new modes: ipc and arch.

vpmu=off (default)

root@lgud-bgregg:~> xl dmesg | grep vpmu
root@lgud-bgregg:~> 

root@vm0hvm:~# perf stat ./noploop

 Performance counter stats for './noploop':

       1499.745527 task-clock (msec)         #    0.982 CPUs utilized          
                54 context-switches          #    0.036 K/sec                  
                 0 cpu-migrations            #    0.000 K/sec                  
               113 page-faults               #    0.075 K/sec                  
   <not supported> cycles                  
   <not supported> stalled-cycles-frontend 
   <not supported> stalled-cycles-backend  
   <not supported> instructions            
   <not supported> branches                
   <not supported> branch-misses           

       1.526790639 seconds time elapsed

root@vm0hvm:~# perf stat -d ./noploop

 Performance counter stats for './noploop':

       1516.745765 task-clock (msec)         #    0.999 CPUs utilized          
                50 context-switches          #    0.033 K/sec                  
                 0 cpu-migrations            #    0.000 K/sec                  
               113 page-faults               #    0.075 K/sec                  
   <not supported> cycles                  
   <not supported> stalled-cycles-frontend 
   <not supported> stalled-cycles-backend  
   <not supported> instructions            
   <not supported> branches                
   <not supported> branch-misses           
   <not supported> L1-dcache-loads         
   <not supported> L1-dcache-load-misses   
   <not supported> LLC-loads               
   <not supported> LLC-load-misses         

       1.517752197 seconds time elapsed

root@vm0hvm:~# perf stat -e r003c -e r013c -e r00c0 -e r4f2e -e r0180 -e r01a2 -e r010e ./noploop

 Performance counter stats for './noploop':

   <not supported> r003c                   
   <not supported> r013c                   
   <not supported> r00c0                   
   <not supported> r4f2e                   
   <not supported> r0180                   
   <not supported> r01a2                   
   <not supported> r010e                   

       1.514596689 seconds time elapsed

vpmu=on

root@lgud-bgregg:~> xl dmesg | grep vpmu
(XEN) Command line: placeholder vpmu=on loglvl=all guest_loglvl=all

root@vm0hvm:~# perf stat ./noploop

 Performance counter stats for './noploop':

       1507.440800 task-clock (msec)         #    1.000 CPUs utilized          
                 3 context-switches          #    0.002 K/sec                  
                 0 cpu-migrations            #    0.000 K/sec                  
               113 page-faults               #    0.075 K/sec                  
     5,030,128,010 cycles                    #    3.337 GHz                    
         7,213,421 stalled-cycles-frontend   #    0.14% frontend cycles idle   
     4,965,684,648 stalled-cycles-backend    #   98.72% backend  cycles idle   
    20,043,873,623 instructions              #    3.98  insns per cycle        
                                             #    0.25  stalled cycles per insn
        10,691,703 branches                  #    7.093 M/sec                  
            11,897 branch-misses             #    0.11% of all branches        

       1.507885894 seconds time elapsed

root@vm0hvm:~# perf stat -d ./noploop

 Performance counter stats for './noploop':

       1507.844761 task-clock (msec)         #    0.982 CPUs utilized          
                41 context-switches          #    0.027 K/sec                  
                 0 cpu-migrations            #    0.000 K/sec                  
               113 page-faults               #    0.075 K/sec                  
     5,030,954,063 cycles                    #    3.337 GHz                    
         7,740,438 stalled-cycles-frontend   #    0.15% frontend cycles idle   
     4,966,031,978 stalled-cycles-backend    #   98.71% backend  cycles idle   
    20,044,349,973 instructions              #    3.98  insns per cycle        
                                             #    0.25  stalled cycles per insn
        10,785,189 branches                  #    7.153 M/sec                  
            16,720 branch-misses             #    0.16% of all branches        
                 0 L1-dcache-loads           #    0.000 K/sec                  
            64,164 L1-dcache-load-misses     #    0.00% of all L1-dcache hits  
                 0 LLC-loads                 #    0.000 K/sec                  
   <not supported> LLC-load-misses:HG      

       1.535188852 seconds time elapsed

root@vm0hvm:~# perf stat -e r003c -e r013c -e r00c0 -e r4f2e -e r0180 -e r01a2 -e r010e ./noploop

 Performance counter stats for './noploop':

     5,029,189,849 r003c                                                       
       149,506,375 r013c                                                       
    20,043,947,740 r00c0                                                       
            24,034 r4f2e                                                       
     1,271,411,108 r0180                                                       
           411,934 r01a2                                                       
    20,058,593,068 r010e                                                       

       1.503972994 seconds time elapsed

vpmu=ipc

root@lgud-bgregg:~> xl dmesg | grep vpmu
(XEN) Command line: placeholder vpmu=ipc loglvl=all guest_loglvl=all

root@vm0hvm:~# perf stat ./noploop

 Performance counter stats for './noploop':

       1507.341723 task-clock (msec)         #    0.999 CPUs utilized          
                46 context-switches          #    0.031 K/sec                  
                 0 cpu-migrations            #    0.000 K/sec                  
               113 page-faults               #    0.075 K/sec                  
     5,028,003,852 cycles                    #    3.336 GHz                    
                 0 stalled-cycles-frontend   #    0.00% frontend cycles idle   
                 0 stalled-cycles-backend    #    0.00% backend  cycles idle   
    20,043,375,516 instructions              #    3.99  insns per cycle        
                 0 branches                  #    0.000 K/sec                  
                 0 branch-misses             #    0.00% of all branches        

       1.509467250 seconds time elapsed

root@vm0hvm:~# perf stat -d ./noploop

 Performance counter stats for './noploop':

       1511.326375 task-clock (msec)         #    0.999 CPUs utilized          
                24 context-switches          #    0.016 K/sec                  
                 0 cpu-migrations            #    0.000 K/sec                  
               113 page-faults               #    0.075 K/sec                  
     5,028,638,883 cycles                    #    3.327 GHz                    
                 0 stalled-cycles-frontend   #    0.00% frontend cycles idle   
                 0 stalled-cycles-backend    #    0.00% backend  cycles idle   
    20,043,427,933 instructions              #    3.99  insns per cycle        
                 0 branches                  #    0.000 K/sec                  
                 0 branch-misses             #    0.00% of all branches        
                 0 L1-dcache-loads           #    0.000 K/sec                  
                 0 L1-dcache-load-misses     #    0.00% of all L1-dcache hits  
                 0 LLC-loads                 #    0.000 K/sec                  
   <not supported> LLC-load-misses:HG      

       1.513292010 seconds time elapsed

root@vm0hvm:~# perf stat -e r003c -e r013c -e r00c0 -e r4f2e -e r0180 -e r01a2 -e r010e ./noploop

 Performance counter stats for './noploop':

     5,028,696,563 r003c                                                       
       149,839,807 r013c                                                       
    20,043,585,995 r00c0                                                       
                 0 r4f2e                                                       
                 0 r0180                                                       
                 0 r01a2                                                       
                 0 r010e                                                       

       1.510042623 seconds time elapsed

vpmu=arch

root@lgud-bgregg:~> xl dmesg | grep vpmu
(XEN) Command line: placeholder vpmu=arch loglvl=all guest_loglvl=all

root@vm0hvm:~# perf stat ./noploop

 Performance counter stats for './noploop':

       1520.094185 task-clock (msec)         #    0.998 CPUs utilized          
                51 context-switches          #    0.034 K/sec                  
                 0 cpu-migrations            #    0.000 K/sec                  
               113 page-faults               #    0.074 K/sec                  
     5,032,584,693 cycles                    #    3.311 GHz                    
                 0 stalled-cycles-frontend   #    0.00% frontend cycles idle   
                 0 stalled-cycles-backend    #    0.00% backend  cycles idle   
    20,045,352,756 instructions              #    3.98  insns per cycle        
        10,958,173 branches                  #    7.209 M/sec                  
            16,925 branch-misses             #    0.15% of all branches        

       1.522474349 seconds time elapsed

root@vm0hvm:~# perf stat -d ./noploop

 Performance counter stats for './noploop':

       1510.478919 task-clock (msec)         #    0.998 CPUs utilized          
                48 context-switches          #    0.032 K/sec                  
                 0 cpu-migrations            #    0.000 K/sec                  
               113 page-faults               #    0.075 K/sec                  
     5,030,765,239 cycles                    #    3.331 GHz                    
                 0 stalled-cycles-frontend   #    0.00% frontend cycles idle   
                 0 stalled-cycles-backend    #    0.00% backend  cycles idle   
    20,044,553,437 instructions              #    3.98  insns per cycle        
        10,818,602 branches                  #    7.162 M/sec                  
            15,169 branch-misses             #    0.14% of all branches        
                 0 L1-dcache-loads           #    0.000 K/sec                  
                 0 L1-dcache-load-misses     #    0.00% of all L1-dcache hits  
                 0 LLC-loads                 #    0.000 K/sec                  
   <not supported> LLC-load-misses:HG      

       1.513579213 seconds time elapsed

root@vm0hvm:~# perf stat -e r003c -e r013c -e r00c0 -e r4f2e -e r0180 -e r01a2 -e r010e ./noploop

 Performance counter stats for './noploop':

     5,030,582,397 r003c                                                       
       150,300,076 r013c                                                       
    20,044,024,689 r00c0                                                       
            30,887 r4f2e                                                       
                 0 r0180                                                       
                 0 r01a2                                                       
                 0 r010e                                                       

       1.516622998 seconds time elapsed

system

/proc/cpuinfo:
model name	: Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment