• Kan Liang's avatar
    perf stat: Add support to measure SMI cost · daefd0bc
    Kan Liang authored
    Implementing a new --smi-cost mode in perf stat to measure SMI cost.
    
    During the measurement, the /sys/device/cpu/freeze_on_smi will be set.
    
    The measurement can be done with one counter (unhalted core cycles), and
    two free running MSR counters (IA32_APERF and SMI_COUNT).
    
    In practice, the percentages of SMI core cycles should be more useful
    than absolute value. So the output will be the percentage of SMI core
    cycles and SMI#. metric_only will be set by default.
    
    SMI cycles% = (aperf - unhalted core cycles) / aperf
    
    Here is an example output.
    
     Performance counter stats for 'sudo echo ':
    
    SMI cycles%          SMI#
        0.1%              1
    
           0.010858678 seconds time elapsed
    
    Users who wants to get the actual value can apply additional
    --no-metric-only.
    Signed-off-by: default avatarKan Liang <Kan.liang@intel.com>
    Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Kan Liang <kan.liang@intel.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Robert Elliott <elliott@hpe.com>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/1495825538-5230-3-git-send-email-kan.liang@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    daefd0bc
perf-stat.txt 9.34 KB