• Pratyush Anand's avatar
    arm64: perf: Allow more than one cycle counter to be used · 1031a159
    Pratyush Anand authored
    Currently:
    $ perf stat -e cycles:u -e cycles:k  true
    
     Performance counter stats for 'true':
    
              2,24,699      cycles:u
         <not counted>      cycles:k	(0.00%)
    
           0.000788087 seconds time elapsed
    
    We can not count more than one cycle counter in one instance,because we
    allow to map cycle counter into PMCCNTR_EL0 only. However, if I did not
    miss anything then specification do not prohibit to use PMEVCNTR<n>_EL0
    for cycle count as well.
    
    Modify the code so that it still prefers to use PMCCNTR_EL0 for cycle
    counter, however allow to use PMEVCNTR<n>_EL0 if PMCCNTR_EL0 is already
    in use.
    
    After this patch:
    
    $ perf stat -e cycles:u -e cycles:k   true
    
     Performance counter stats for 'true':
    
              2,17,310      cycles:u
              7,40,009      cycles:k
    
           0.000764149 seconds time elapsed
    Signed-off-by: default avatarPratyush Anand <panand@redhat.com>
    Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
    1031a159
perf_event.c 39.7 KB