brintos

brintos / linux-shallow public Read only

0
0
Text · 26.4 KiB · 067717b Raw
504 lines · plain
1.TH TURBOSTAT 82.SH NAME3turbostat \- Report processor frequency and idle statistics4.SH SYNOPSIS5.ft B6.B turbostat7.RB [ Options ]8.RB command9.br10.B turbostat11.RB [ Options ]12.RB [ "\--interval seconds" ]13.SH DESCRIPTION14\fBturbostat \fP reports processor topology, frequency,15idle power-state statistics, temperature and power on X86 processors.16There are two ways to invoke turbostat.17The first method is to supply a18\fBcommand\fP, which is forked and statistics are printed19in one-shot upon its completion.20The second method is to omit the command,21and turbostat displays statistics every 5 seconds interval.22The 5-second interval can be changed using the --interval option.23.PP24Some information is not available on older processors.25.SS Options26Options can be specified with a single or double '-', and only as much of the option27name as necessary to disambiguate it from others is necessary.  Note that options are case-sensitive.28.PP29\fB--add attributes\fP add column with counter having specified 'attributes'.  The 'location' attribute is required, all others are optional.30.nf31	location: {\fBmsrDDD\fP | \fBmsr0xXXX\fP | \fB/sys/path...\fP | \fBperf/<device>/<event>\fP}32		msrDDD is a decimal offset, eg. msr1633		msr0xXXX is a hex offset, eg. msr0x1034		/sys/path... is an absolute path to a sysfs attribute35		<device> is a perf device from /sys/bus/event_source/devices/<device> eg. cstate_core36		<event> is a perf event for given device from /sys/bus/event_source/devices/<device>/events/<event> eg. c1-residency37			perf/cstate_core/c1-residency would then use /sys/bus/event_source/devices/cstate_core/events/c1-residency38 39	scope: {\fBcpu\fP | \fBcore\fP | \fBpackage\fP}40		sample and print the counter for every cpu, core, or package.41		default: cpu42 43	size: {\fBu32\fP | \fBu64\fP }44		MSRs are read as 64-bits, u32 truncates the displayed value to 32-bits.45		default: u6446 47	format: {\fBraw\fP | \fBdelta\fP | \fBpercent\fP}48		'raw' shows the MSR contents in hex.49		'delta' shows the difference in values during the measurement interval.50		'percent' shows the delta as a percentage of the cycles elapsed.51		default: delta52 53	name: "name_string"54		Any string that does not match a key-word above is used55		as the column header.56.fi57.PP58\fB--add pmt,[attr_name=attr_value, ...]\fP add column with a PMT (Intel Platform Monitoring Technology) counter in a similar way to --add option above, but require PMT metadata to be supplied to correctly read and display the counter. The metadata can be found in the Intel PMT XML files, hosted at https://github.com/intel/Intel-PMT. For a complete example see "ADD PMT COUNTER EXAMPLE".59.nf60	name="name_string"61		For column header.62 63	type={\fBraw\fP}64		'raw' shows the counter contents in hex.65		default: raw66 67	format={\fBraw\fP | \fBdelta\fP}68		'raw' shows the counter contents in hex.69		'delta' shows the difference in values during the measurement interval.70		default: raw71 72	domain={\fBcpu%u\fP | \fBcore%u\fP | \fBpackage%u\fP}73		'cpu' per cpu/thread counter.74		'core' per core counter.75		'package' per package counter.76		'%u' denotes id of the domain that the counter is associated with. For example core4 would mean that the counter is associated with core number 4.77 78	offset=\fB%u\fP79		'%u' offset within the PMT MMIO region.80 81	lsb=\fB%u\fP82		'%u' least significant bit within the 64 bit value read from 'offset'. Together with 'msb', used to form a read mask.83 84	msb=\fB%u\fP85		'%u' most significant bit within the 64 bit value read from 'offset'. Together with 'lsb', used to form a read mask.86 87	guid=\fB%x\fP88		'%x' hex identifier of the PMT MMIO region.89.fi90.PP91\fB--cpu cpu-set\fP limit output to system summary plus the specified cpu-set.  If cpu-set is the string "core", then the system summary plus the first CPU in each core are printed -- eg. subsequent HT siblings are not printed.  Or if cpu-set is the string "package", then the system summary plus the first CPU in each package is printed.  Otherwise, the system summary plus the specified set of CPUs are printed.  The cpu-set is ordered from low to high, comma delimited with ".." and "-" permitted to denote a range. eg. 1,2,8,14..17,21-4492.PP93\fB--hide column\fP do not show the specified built-in columns.  May be invoked multiple times, or with a comma-separated list of column names.94.PP95\fB--enable column\fP show the specified built-in columns, which are otherwise disabled, by default.  Currently the only built-in counters disabled by default are "usec", "Time_Of_Day_Seconds", "APIC" and "X2APIC".96The column name "all" can be used to enable all disabled-by-default built-in counters.97.PP98\fB--show column\fP show only the specified built-in columns.  May be invoked multiple times, or with a comma-separated list of column names.99.PP100\fB--show CATEGORY --hide CATEGORY\fP  Show and hide also accept a single CATEGORY of columns: "all", "topology", "idle", "frequency", "power", "sysfs", "other".101.PP102\fB--Dump\fP displays the raw counter values.103.PP104\fB--quiet\fP Do not decode and print the system configuration header information.105.PP106\fB--no-msr\fP Disable all the uses of the MSR driver.107.PP108\fB--no-perf\fP Disable all the uses of the perf API.109.PP110\fB--interval seconds\fP overrides the default 5.0 second measurement interval.111.PP112\fB--num_iterations num\fP number of the measurement iterations.113.PP114\fB--out output_file\fP turbostat output is written to the specified output_file.115The file is truncated if it already exists, and it is created if it does not exist.116.PP117\fB--help\fP displays usage for the most common parameters.118.PP119\fB--Joules\fP displays energy in Joules, rather than dividing Joules by time to print power in Watts.120.PP121\fB--list\fP display column header names available for use by --show and --hide, then exit.122.PP123\fB--Summary\fP limits output to a 1-line System Summary for each interval.124.PP125\fB--TCC temperature\fP sets the Thermal Control Circuit temperature for systems which do not export that value.  This is used for making sense of the Digital Thermal Sensor outputs, as they return degrees Celsius below the TCC activation temperature.126.PP127\fB--version\fP displays the version.128.PP129The \fBcommand\fP parameter forks \fBcommand\fP, and upon its exit,130displays the statistics gathered since it was forked.131.PP132.SH ROW DESCRIPTIONS133The system configuration dump (if --quiet is not used) is followed by statistics.  The first row of the statistics labels the content of each column (below).  The second row of statistics is the system summary line.  The system summary line has a '-' in the columns for the Package, Core, and CPU.  The contents of the system summary line depends on the type of column.  Columns that count items (eg. IRQ) show the sum across all CPUs in the system.  Columns that show a percentage show the average across all CPUs in the system.  Columns that dump raw MSR values simply show 0 in the summary.  After the system summary row, each row describes a specific Package/Core/CPU.  Note that if the --cpu parameter is used to limit which specific CPUs are displayed, turbostat will still collect statistics for all CPUs in the system and will still show the system summary for all CPUs in the system.134.SH COLUMN DESCRIPTIONS135.PP136\fBusec\fP For each CPU, the number of microseconds elapsed during counter collection, including thread migration -- if any.  This counter is disabled by default, and is enabled with "--enable usec", or --debug.  On the summary row, usec refers to the total elapsed time to collect the counters on all cpus.137.PP138\fBTime_Of_Day_Seconds\fP For each CPU, the gettimeofday(2) value (seconds.subsec since Epoch) when the counters ending the measurement interval were collected.  This column is disabled by default, and can be enabled with "--enable Time_Of_Day_Seconds" or "--debug".  On the summary row, Time_Of_Day_Seconds refers to the timestamp following collection of counters on the last CPU.139.PP140\fBCore\fP processor core number.  Note that multiple CPUs per core indicate support for Intel(R) Hyper-Threading Technology (HT).141.PP142\fBCPU\fP Linux CPU (logical processor) number.  Yes, it is okay that on many systems the CPUs are not listed in numerical order -- for efficiency reasons, turbostat runs in topology order, so HT siblings appear together.143.PP144\fBPackage\fP processor package number -- not present on systems with a single processor package.145.PP146\fBAvg_MHz\fP number of cycles executed divided by time elapsed.  Note that this includes idle-time when 0 instructions are executed.147.PP148\fBBusy%\fP percent of the measurement interval that the CPU executes instructions, aka. % of time in "C0" state.149.PP150\fBBzy_MHz\fP average clock rate while the CPU was not idle (ie. in "c0" state).151.PP152\fBTSC_MHz\fP average MHz that the TSC ran during the entire interval.153.PP154\fBIRQ\fP The number of interrupts serviced by that CPU during the measurement interval.  The system total line is the sum of interrupts serviced across all CPUs.  turbostat parses /proc/interrupts to generate this summary.155.PP156\fBSMI\fP The number of System Management Interrupts  serviced CPU during the measurement interval.  While this counter is actually per-CPU, SMI are triggered on all processors, so the number should be the same for all CPUs.157.PP158\fBC1, C2, C3...\fP The number times Linux requested the C1, C2, C3 idle state during the measurement interval.  The system summary line shows the sum for all CPUs.  These are C-state names as exported in /sys/devices/system/cpu/cpu*/cpuidle/state*/name.  While their names are generic, their attributes are processor specific. They the system description section of output shows what MWAIT sub-states they are mapped to on each system.159.PP160\fBC1%, C2%, C3%\fP The residency percentage that Linux requested C1, C2, C3....  The system summary is the average of all CPUs in the system.  Note that these are software, reflecting what was requested.  The hardware counters reflect what was actually achieved.161.PP162\fBCPU%c1, CPU%c3, CPU%c6, CPU%c7\fP show the percentage residency in hardware core idle states.  These numbers are from hardware residency counters.163.PP164\fBCoreTmp\fP Degrees Celsius reported by the per-core Digital Thermal Sensor.165.PP166\fBPkgTmp\fP Degrees Celsius reported by the per-package Package Thermal Monitor.167.PP168\fBGFX%rc6\fP The percentage of time the GPU is in the "render C6" state, rc6, during the measurement interval. From /sys/class/drm/card0/power/rc6_residency_ms or /sys/class/drm/card0/gt/gt0/rc6_residency_ms or /sys/class/drm/card0/device/tile0/gtN/gtidle/idle_residency_ms depending on the graphics driver being used.169.PP170\fBGFXMHz\fP Instantaneous snapshot of what sysfs presents at the end of the measurement interval. From /sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz or /sys/class/drm/card0/gt_cur_freq_mhz or /sys/class/drm/card0/gt/gt0/rps_cur_freq_mhz or /sys/class/drm/card0/device/tile0/gtN/freq0/cur_freq depending on the graphics driver being used.171.PP172\fBGFXAMHz\fP Instantaneous snapshot of what sysfs presents at the end of the measurement interval. From /sys/class/graphics/fb0/device/drm/card0/gt_act_freq_mhz or /sys/class/drm/card0/gt_act_freq_mhz or /sys/class/drm/card0/gt/gt0/rps_act_freq_mhz or /sys/class/drm/card0/device/tile0/gtN/freq0/act_freq depending on the graphics driver being used.173.PP174\fBSAM%mc6\fP The percentage of time the SA Media is in the "module C6" state, mc6, during the measurement interval. From /sys/class/drm/card0/gt/gt1/rc6_residency_ms or /sys/class/drm/card0/device/tile0/gtN/gtidle/idle_residency_ms depending on the graphics driver being used.175.PP176\fBSAMMHz\fP Instantaneous snapshot of what sysfs presents at the end of the measurement interval. From /sys/class/drm/card0/gt/gt1/rps_cur_freq_mhz or /sys/class/drm/card0/device/tile0/gtN/freq0/cur_freq depending on the graphics driver being used.177.PP178\fBSAMAMHz\fP Instantaneous snapshot of what sysfs presents at the end of the measurement interval. From /sys/class/drm/card0/gt/gt1/rps_act_freq_mhz or /sys/class/drm/card0/device/tile0/gtN/freq0/act_freq depending on the graphics driver being used.179.PP180\fBPkg%pc2, Pkg%pc3, Pkg%pc6, Pkg%pc7\fP percentage residency in hardware package idle states.  These numbers are from hardware residency counters.181.PP182\fBPkgWatt\fP Watts consumed by the whole package.183.PP184\fBCorWatt\fP Watts consumed by the core part of the package.185.PP186\fBGFXWatt\fP Watts consumed by the Graphics part of the package -- available only on client processors.187.PP188\fBRAMWatt\fP Watts consumed by the DRAM DIMMS -- available only on server processors.189.PP190\fBPKG_%\fP percent of the interval that RAPL throttling was active on the Package.  Note that the system summary is the sum of the package throttling time, and thus may be higher than 100% on a multi-package system.  Note that the meaning of this field is model specific.  For example, some hardware increments this counter when RAPL responds to thermal limits, but does not increment this counter when RAPL responds to power limits.  Comparing PkgWatt and PkgTmp to system limits is necessary.191.PP192\fBRAM_%\fP percent of the interval that RAPL throttling was active on DRAM.193.PP194\fBUncMHz\fP per-package uncore MHz, instantaneous sample.195.PP196\fBUMHz1.0\fP per-package uncore MHz for domain=1 and fabric_cluster=0, instantaneous sample.  System summary is the average of all packages.197.SH TOO MUCH INFORMATION EXAMPLE198By default, turbostat dumps all possible information -- a system configuration header, followed by columns for all counters.199This is ideal for remote debugging, use the "--out" option to save everything to a text file, and get that file to the expert helping you debug.200.PP201When you are not interested in all that information, and there are several ways to see only what you want.  First the "--quiet" option will skip the configuration information, and turbostat will show only the counter columns.  Second, you can reduce the columns with the "--hide" and "--show" options.  If you use the "--show" option, then turbostat will show only the columns you list.  If you use the "--hide" option, turbostat will show all columns, except the ones you list.202.PP203To find out what columns are available for --show and --hide, the "--list" option is available.  Usually, the CATEGORY names above are used to refer to groups of counters.  Also, for convenience, the special string "sysfs" can be used to refer to all of the sysfs C-state counters at once:204.PP205.nf206sudo ./turbostat --show sysfs --quiet sleep 1020710.003837 sec208	C1	C1E	C3	C6	C7s	C1%	C1E%	C3%	C6%	C7s%209	4	21	2	2	459	0.14	0.82	0.00	0.00	98.93210	1	17	2	2	130	0.00	0.02	0.00	0.00	99.80211	0	0	0	0	31	0.00	0.00	0.00	0.00	99.95212	2	1	0	0	52	1.14	6.49	0.00	0.00	92.21213	1	2	0	0	52	0.00	0.08	0.00	0.00	99.86214	0	0	0	0	71	0.00	0.00	0.00	0.00	99.89215	0	0	0	0	25	0.00	0.00	0.00	0.00	99.96216	0	0	0	0	74	0.00	0.00	0.00	0.00	99.94217	0	1	0	0	24	0.00	0.00	0.00	0.00	99.84218.fi219.PP220.SH ONE SHOT COMMAND EXAMPLE221If turbostat is invoked with a command, it will fork that command222and output the statistics gathered after the command exits.223In this case, turbostat output goes to stderr, by default.224Output can instead be saved to a file using the --out option.225In this example, the "sleep 10" command is forked, and turbostat waits for it to complete before saving all statistics into "ts.out".  Note that "sleep 10" is not part of turbostat, but is simply an example of a command that turbostat can fork.  The "ts.out" file is what you want to edit in a very wide window, paste into a spreadsheet, or attach to a bugzilla entry.226 227.nf228[root@hsw]# ./turbostat -o ts.out sleep 10229[root@hsw]#230.fi231 232.SH PERIODIC INTERVAL EXAMPLE233Without a command to fork, turbostat displays statistics ever 5 seconds.234Periodic output goes to stdout, by default, unless --out is used to specify an output file.235The 5-second interval can be changed with the "-i sec" option.236.nf237sudo turbostat --quiet --show CPU,frequency238	Core	CPU	Avg_MHz	Busy%	Bzy_MHz	TSC_MHz	CPU%c7	UncMhz239	-	-	524	12.48	4198	3096	74.53	3800240	0	0	4	0.09	4081	3096	98.88	3800241	0	4	1	0.02	4063	3096242	1	1	2	0.06	4063	3096	99.60243	1	5	2	0.05	4070	3096244	2	2	4178	99.52	4199	3096	0.00245	2	6	3	0.08	4159	3096246	3	3	1	0.04	4046	3096	99.66247	3	7	0	0.01	3989	3096248	Core	CPU	Avg_MHz	Busy%	Bzy_MHz	TSC_MHz	CPU%c7	UncMhz249	-	-	525	12.52	4198	3096	74.54	3800250	0	0	4	0.10	4051	3096	99.49	3800251	0	4	2	0.04	3993	3096252	1	1	3	0.07	4054	3096	99.56253	1	5	4	0.10	4018	3096254	2	2	4178	99.51	4199	3096	0.00255	2	6	4	0.09	4143	3096256	3	3	2	0.06	4026	3096	99.10257	3	7	7	0.17	4074	3096258.fi259This example also shows the use of the --show option to show only the desired columns.260 261.SH SYSTEM CONFIGURATION INFORMATION EXAMPLE262 263By default, turbostat always dumps system configuration information264before taking measurements.  In the example above, "--quiet" is used265to suppress that output.  Here is an example of the configuration information:266.nf267turbostat version 2022.04.16 - Len Brown <lenb@kernel.org>268Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.18.0-rc6-00001-ge6891250e3b5 ...269CPUID(0): GenuineIntel 0x16 CPUID levels270CPUID(1): family:model:stepping 0x6:9e:9 (6:158:9) microcode 0xea271CPUID(0x80000000): max_extended_levels: 0x80000008272CPUID(1): SSE3 MONITOR - EIST TM2 TSC MSR ACPI-TM HT TM273CPUID(6): APERF, TURBO, DTS, PTM, HWP, HWPnotify, HWPwindow, HWPepp, No-HWPpkg, EPB274cpu7: MSR_IA32_MISC_ENABLE: 0x00850089 (TCC EIST MWAIT PREFETCH TURBO)275CPUID(7): SGX276cpu7: MSR_IA32_FEATURE_CONTROL: 0x00000005 (Locked )277CPUID(0x15): eax_crystal: 2 ebx_tsc: 258 ecx_crystal_hz: 0278TSC: 3096 MHz (24000000 Hz * 258 / 2 / 1000000)279CPUID(0x16): base_mhz: 3100 max_mhz: 4200 bus_mhz: 100280cpu7: MSR_MISC_PWR_MGMT: 0x00401cc0 (ENable-EIST_Coordination DISable-EPB DISable-OOB)281RAPL: 5825 sec. Joule Counter Range, at 45 Watts282cpu7: MSR_PLATFORM_INFO: 0x80839f1011f002838 * 100.0 = 800.0 MHz max efficiency frequency28431 * 100.0 = 3100.0 MHz base frequency285cpu7: MSR_IA32_POWER_CTL: 0x002c005d (C1E auto-promotion: DISabled)286cpu7: MSR_TURBO_RATIO_LIMIT: 0x2728292a28739 * 100.0 = 3900.0 MHz max turbo 4 active cores28840 * 100.0 = 4000.0 MHz max turbo 3 active cores28941 * 100.0 = 4100.0 MHz max turbo 2 active cores29042 * 100.0 = 4200.0 MHz max turbo 1 active cores291cpu7: MSR_CONFIG_TDP_NOMINAL: 0x0000001f (base_ratio=31)292cpu7: MSR_CONFIG_TDP_LEVEL_1: 0x00000000 ()293cpu7: MSR_CONFIG_TDP_LEVEL_2: 0x00000000 ()294cpu7: MSR_CONFIG_TDP_CONTROL: 0x80000000 ( lock=1)295cpu7: MSR_TURBO_ACTIVATION_RATIO: 0x00000000 (MAX_NON_TURBO_RATIO=0 lock=0)296cpu7: MSR_PKG_CST_CONFIG_CONTROL: 0x1e008008 (UNdemote-C3, UNdemote-C1, demote-C3, demote-C1, locked, pkg-cstate-limit=8 (unlimited))297Uncore Frequency pkg0 die0: 800 - 3900 MHz (800 - 3900 MHz)298/dev/cpu_dma_latency: 2000000000 usec (default)299current_driver: intel_idle300current_governor: menu301current_governor_ro: menu302cpu7: POLL: CPUIDLE CORE POLL IDLE303cpu7: C1: MWAIT 0x00304cpu7: C1E: MWAIT 0x01305cpu7: C3: MWAIT 0x10306cpu7: C6: MWAIT 0x20307cpu7: C7s: MWAIT 0x33308cpu7: C8: MWAIT 0x40309cpu7: C9: MWAIT 0x50310cpu7: C10: MWAIT 0x60311cpu7: cpufreq driver: intel_pstate312cpu7: cpufreq governor: performance313cpufreq intel_pstate no_turbo: 0314cpu7: MSR_MISC_FEATURE_CONTROL: 0x00000000 (L2-Prefetch L2-Prefetch-pair L1-Prefetch L1-IP-Prefetch)315cpu0: MSR_PM_ENABLE: 0x00000001 (HWP)316cpu0: MSR_HWP_CAPABILITIES: 0x01101f53 (high 83 guar 31 eff 16 low 1)317cpu0: MSR_HWP_REQUEST: 0x00005353 (min 83 max 83 des 0 epp 0x0 window 0x0 pkg 0x0)318cpu0: MSR_HWP_INTERRUPT: 0x00000001 (EN_Guaranteed_Perf_Change, Dis_Excursion_Min)319cpu0: MSR_HWP_STATUS: 0x00000004 (No-Guaranteed_Perf_Change, No-Excursion_Min)320cpu0: EPB: 6 (balanced)321cpu0: MSR_RAPL_POWER_UNIT: 0x000a0e03 (0.125000 Watts, 0.000061 Joules, 0.000977 sec.)322cpu0: MSR_PKG_POWER_INFO: 0x00000168 (45 W TDP, RAPL 0 - 0 W, 0.000000 sec.)323cpu0: MSR_PKG_POWER_LIMIT: 0x42820800218208 (UNlocked)324cpu0: PKG Limit #1: ENabled (65.000 Watts, 64.000000 sec, clamp ENabled)325cpu0: PKG Limit #2: ENabled (65.000 Watts, 0.002441* sec, clamp DISabled)326cpu0: MSR_VR_CURRENT_CONFIG: 0x00000000327cpu0: PKG Limit #4: 0.000000 Watts (UNlocked)328cpu0: MSR_DRAM_POWER_LIMIT: 0x5400de00000000 (UNlocked)329cpu0: DRAM Limit: DISabled (0.000 Watts, 0.000977 sec, clamp DISabled)330cpu0: MSR_PP0_POLICY: 0331cpu0: MSR_PP0_POWER_LIMIT: 0x00000000 (UNlocked)332cpu0: Cores Limit: DISabled (0.000 Watts, 0.000977 sec, clamp DISabled)333cpu0: MSR_PP1_POLICY: 0334cpu0: MSR_PP1_POWER_LIMIT: 0x00000000 (UNlocked)335cpu0: GFX Limit: DISabled (0.000 Watts, 0.000977 sec, clamp DISabled)336cpu0: MSR_IA32_TEMPERATURE_TARGET: 0x00640000 (100 C) (100 default - 0 offset)337cpu0: MSR_IA32_PACKAGE_THERM_STATUS: 0x88200800 (68 C)338cpu0: MSR_IA32_PACKAGE_THERM_INTERRUPT: 0x00000003 (100 C, 100 C)339cpu7: MSR_PKGC3_IRTL: 0x0000884e (valid, 79872 ns)340cpu7: MSR_PKGC6_IRTL: 0x00008876 (valid, 120832 ns)341cpu7: MSR_PKGC7_IRTL: 0x00008894 (valid, 151552 ns)342cpu7: MSR_PKGC8_IRTL: 0x000088fa (valid, 256000 ns)343cpu7: MSR_PKGC9_IRTL: 0x0000894c (valid, 339968 ns)344cpu7: MSR_PKGC10_IRTL: 0x00008bf2 (valid, 1034240 ns)345.fi346.PP347The \fBmax efficiency\fP frequency, a.k.a. Low Frequency Mode, is the frequency348available at the minimum package voltage.  The \fBTSC frequency\fP is the base349frequency of the processor -- this should match the brand string350in /proc/cpuinfo.  This base frequency351should be sustainable on all CPUs indefinitely, given nominal power and cooling.352The remaining rows show what maximum turbo frequency is possible353depending on the number of idle cores.  Note that not all information is354available on all processors.355.SH ADD COUNTER EXAMPLE356Here we limit turbostat to showing just the CPU number for cpu0 - cpu3.357We add a counter showing the 32-bit raw value of MSR 0x199 (MSR_IA32_PERF_CTL),358labeling it with the column header, "PRF_CTRL", and display it only once,359after the conclusion of a 0.1 second sleep.360.nf361sudo ./turbostat --quiet --cpu 0-3 --show CPU --add msr0x199,u32,raw,PRF_CTRL sleep .13620.101604 sec363CPU	  PRF_CTRL364-	0x000000003650	0x00000c003661	0x000008003672	0x00000a003683	0x00000800369 370.fi371 372.SH ADD PERF COUNTER EXAMPLE373Here we limit turbostat to showing just the CPU number for cpu0 - cpu3.374We add a counter showing time spent in C1 core cstate,375labeling it with the column header, "pCPU%c1", and display it only once,376after the conclusion of 0.1 second sleep.377We also show CPU%c1 built-in counter that should show similar values.378.nf379sudo ./turbostat --quiet --cpu 0-3 --show CPU,CPU%c1 --add perf/cstate_core/c1-residency,cpu,delta,percent,pCPU%c1 sleep .13800.102448 sec381CPU     pCPU%c1 CPU%c1382-       34.89   34.893830       45.99   45.993841       45.94   45.943852       23.83   23.833863       23.84   23.84387 388.fi389 390.SH ADD PMT COUNTER EXAMPLE391Here we limit turbostat to showing just the CPU number 0.392We add two counters, showing crystal clock count and the DC6 residency.393All the parameters passed are based on the metadata found in the PMT XML files.394 395For the crystal clock count, we396label it with the column header, "XTAL",397we set the type to 'raw', to read the number of clock ticks in hex,398we set the format to 'delta', to display the difference in ticks during the measurement interval,399we set the domain to 'package0', to collect it and associate it with the whole package number 0,400we set the offset to '0', which is a offset of the counter within the PMT MMIO region,401we set the lsb and msb to cover all 64 bits of the read 64 bit value,402and finally we set the guid to '0x1a067102', that identifies the PMT MMIO region to which the 'offset' is applied to read the counter value.403 404For the DC6 residency counter, we405label it with the column header, "Die%c6",406we set the type to 'txtal_time', to obtain the percent residency value407we set the format to 'delta', to display the difference in ticks during the measurement interval,408we set the domain to 'package0', to collect it and associate it with the whole package number 0,409we set the offset to '0', which is a offset of the counter within the PMT MMIO region,410we set the lsb and msb to cover all 64 bits of the read 64 bit value,411and finally we set the guid to '0x1a067102', that identifies the PMT MMIO region to which the 'offset' is applied to read the counter value.412 413.nf414sudo ./turbostat --quiet --cpu 0 --show CPU --add pmt,name=XTAL,type=raw,format=delta,domain=package0,offset=0,lsb=0,msb=63,guid=0x1a067102 --add pmt,name=Die%c6,type=txtal_time,format=delta,domain=package0,offset=120,lsb=0,msb=63,guid=0x1a0671024150.104352 sec416CPU                   XTAL      Die%c6417-       0x0000006d4d957ca7      0.004180       0x0000006d4d957ca7      0.004190.102448 sec420.fi421 422.SH INPUT423 424For interval-mode, turbostat will immediately end the current interval425when it sees a newline on standard input.426turbostat will then start the next interval.427Control-C will be send a SIGINT to turbostat,428which will immediately abort the program with no further processing.429.SH SIGNALS430 431SIGINT will interrupt interval-mode.432The end-of-interval data will be collected and displayed before turbostat exits.433 434SIGUSR1 will end current interval,435end-of-interval data will be collected and displayed before turbostat436starts a new interval.437.SH NOTES438 439.B "turbostat "440must be run as root.441Alternatively, non-root users can be enabled to run turbostat this way:442 443# setcap cap_sys_admin,cap_sys_rawio,cap_sys_nice=+ep path/to/turbostat444 445# chmod +r /dev/cpu/*/msr446 447# chmod +r /dev/cpu_dma_latency448 449.B "turbostat "450reads hardware counters, but doesn't write them.451So it will not interfere with the OS or other programs, including452multiple invocations of itself.453 454\fBturbostat \fP455may work poorly on Linux-2.6.20 through 2.6.29,456as \fBacpi-cpufreq \fPperiodically cleared the APERF and MPERF MSRs457in those kernels.458 459AVG_MHz = APERF_delta/measurement_interval.  This is the actual460number of elapsed cycles divided by the entire sample interval --461including idle time.  Note that this calculation is resilient462to systems lacking a non-stop TSC.463 464TSC_MHz = TSC_delta/measurement_interval.465On a system with an invariant TSC, this value will be constant466and will closely match the base frequency value shown467in the brand string in /proc/cpuinfo.  On a system where468the TSC stops in idle, TSC_MHz will drop469below the processor's base frequency.470 471Busy% = MPERF_delta/TSC_delta472 473Bzy_MHz = TSC_delta*APERF_delta/MPERF_delta/measurement_interval474 475Note that these calculations depend on TSC_delta, so they476are not reliable during intervals when TSC_MHz is not running at the base frequency.477 478Turbostat data collection is not atomic.479Extremely short measurement intervals (much less than 1 second),480or system activity that prevents turbostat from being able481to run on all CPUS to quickly collect data, will result in482inconsistent results.483 484The APERF, MPERF MSRs are defined to count non-halted cycles.485Although it is not guaranteed by the architecture, turbostat assumes486that they count at TSC rate, which is true on all processors tested to date.487 488.SH REFERENCES489Volume 3B: System Programming Guide"490https://www.intel.com/products/processor/manuals/491 492.SH FILES493.ta494.nf495/dev/cpu/*/msr496.fi497 498.SH "SEE ALSO"499msr(4), vmstat(8)500.PP501.SH AUTHOR502.nf503Written by Len Brown <len.brown@intel.com>504