• Len Brown's avatar
    tools/power turbostat: print sysfs C-state stats · 41618e63
    Len Brown authored
    When turbostat shows % of time in a CPU idle power state,
    it has always been showing information from underlying
    hardware residency counters.
    
    While this reflects what the hardware is doing, and is thus
    useful for understanding the hardware,
    it doesn't directly tell us what Linux requested --
    which is useful for tuning Linux itself.
    
    Here we add columns to turbostat to show the
    Linux cpuidle sub-system statistics:
    /sys/devices/system/cpu/cpu*/cpuidle/state*/*
    
    The first group of columns are the "usage", which is the
    number of times software requested that C-state in the
    measurement interval. eg C1 below.
    
    The second group of columns are the "time", which is the percentage
    of the measurement interval time that software has requested
    the specified C-state. eg C1% below.
    
    These software counters can be compared to the underlying
    hardware residency counters (eg CPU%c1	CPU%c3	CPU%c6	CPU%c7)
    to compare what sofware requested to what the hardware delivered.
    
    These sysfs attributes are discovered when turbostat starts,
    rather than being "built in".  So the --show and --hide
    parameters do not know about these dynamic column names.
    However "--show sysfs" and "--hide sysfs" act on the
    entire group of columns:
    
    turbostat --show sysfs
    ...
    cpu4: POLL: CPUIDLE CORE POLL IDLE
    cpu4: C1: MWAIT 0x00
    cpu4: C1E: MWAIT 0x01
    cpu4: C3: MWAIT 0x10
    cpu4: C6: MWAIT 0x20
    cpu4: C7s: MWAIT 0x32
    ...
    C1 	C1E	C3 	C6 	C7s	C1% 	C1E%	C3%	C6% 	C7s%
    3	6	5	1	188	0.00	0.02	0.00	0.00	99.93
    0	6	5	0	58	0.00	0.16	0.02	0.00	99.70
    0	0	0	0	9	0.00	0.00	0.00	0.00	99.96
    0	0	0	1	24	0.00	0.00	0.00	0.02	99.93
    0	0	0	0	9	0.00	0.00	0.00	0.00	99.97
    0	0	0	0	32	0.00	0.00	0.00	0.00	99.96
    0	0	0	0	7	0.00	0.00	0.00	0.00	99.98
    2	0	0	0	36	0.00	0.00	0.00	0.00	99.97
    1	0	0	0	13	0.00	0.00	0.00	0.00	99.98
    Signed-off-by: default avatarLen Brown <len.brown@intel.com>
    41618e63
turbostat.8 12.6 KB