• Len Brown's avatar
    tools/power turbostat: relax dependency on invariant TSC · d7899447
    Len Brown authored
    Turbostat can be useful on systems that do not support invariant TSC,
    so allow it to run on those systgems.
    
    All arithmetic in turbostat using the TSC value is per-processsor,
    so it does not depend on the TSC values being in sync acrosss processors.
    
    Turbostat uses gettimeofday() for the measurement interval
    rather than using the TSC directly, so that key metric
    is also immune from variable TSC.
    
    Turbostat prints a TSC sanity check column:
    
    TSC_MHz = TSC_delta/interval
    
    If this column is constant and is close to the processor
    base frequency, then the TSC is behaving properly.
    
    The other key turbostat columns are calculated this way:
    
    Avg_Mhz = APERF_delta/interval
    
    %Busy = MPERF_delta/TSC_delta
    
    Bzy_MHz = TSC_delta/APERF_delta/MPERF_delta/interval
    
    Tested on Core2 and Core2-Xeon, and so this patch includes
    a few other changes to remove the assumption that target
    systems are Nehalem and newer.
    Signed-off-by: default avatarLen Brown <len.brown@intel.com>
    d7899447
turbostat.c 66.6 KB