turbostat.8 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. .TH TURBOSTAT 8
  2. .SH NAME
  3. turbostat \- Report processor frequency and idle statistics
  4. .SH SYNOPSIS
  5. .ft B
  6. .B turbostat
  7. .RB [ Options ]
  8. .RB command
  9. .br
  10. .B turbostat
  11. .RB [ Options ]
  12. .RB [ "\--interval seconds" ]
  13. .SH DESCRIPTION
  14. \fBturbostat \fP reports processor topology, frequency,
  15. idle power-state statistics, temperature and power on X86 processors.
  16. There are two ways to invoke turbostat.
  17. The first method is to supply a
  18. \fBcommand\fP, which is forked and statistics are printed
  19. upon its completion.
  20. The second method is to omit the command,
  21. and turbostat displays statistics every 5 seconds.
  22. The 5-second interval can be changed using the --interval option.
  23. .PP
  24. Some information is not available on older processors.
  25. .SS Options
  26. Options can be specified with a single or double '-', and only as much of the option
  27. name as necessary to disambiguate it from others is necessary. Note that options are case-sensitive.
  28. .PP
  29. \fB--add attributes\fP add column with counter having specified 'attributes'. The 'location' attribute is required, all others are optional.
  30. .nf
  31. location: {\fBmsrDDD\fP | \fBmsr0xXXX\fP}
  32. msrDDD is a decimal offset, eg. msr16
  33. msr0xXXX is a hex offset, eg. msr0x10
  34. scope: {\fBcpu\fP | \fBcore\fP | \fBpackage\fP}
  35. sample and print the counter for every cpu, core, or package.
  36. default: cpu
  37. size: {\fBu32\fP | \fBu64\fP }
  38. MSRs are read as 64-bits, u32 truncates the displayed value to 32-bits.
  39. default: u64
  40. format: {\fBraw\fP | \fBdelta\fP | \fBpercent\fP}
  41. 'raw' shows the MSR contents in hex.
  42. 'delta' shows the difference in values during the measurement interval.
  43. 'percent' shows the delta as a percentage of the cycles elapsed.
  44. default: delta
  45. .fi
  46. .PP
  47. \fB--Dump\fP displays the raw counter values.
  48. .PP
  49. \fB--debug\fP displays additional system configuration information. Invoking this parameter
  50. more than once may also enable internal turbostat debug information.
  51. .PP
  52. \fB--interval seconds\fP overrides the default 5.0 second measurement interval.
  53. .PP
  54. \fB--out output_file\fP turbostat output is written to the specified output_file.
  55. The file is truncated if it already exists, and it is created if it does not exist.
  56. .PP
  57. \fB--help\fP displays usage for the most common parameters.
  58. .PP
  59. \fB--Joules\fP displays energy in Joules, rather than dividing Joules by time to print power in Watts.
  60. .PP
  61. \fB--Package\fP limits output to the system summary plus the 1st thread in each Package.
  62. .PP
  63. \fB--processor\fP limits output to the system summary plus the 1st thread in each processor of each package. Ie. it skips hyper-threaded siblings.
  64. .PP
  65. \fB--Summary\fP limits output to a 1-line System Summary for each interval.
  66. .PP
  67. \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.
  68. .PP
  69. \fB--version\fP displays the version.
  70. .PP
  71. The \fBcommand\fP parameter forks \fBcommand\fP, and upon its exit,
  72. displays the statistics gathered since it was forked.
  73. .PP
  74. .SH DEFAULT FIELD DESCRIPTIONS
  75. .nf
  76. \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.
  77. \fBAVG_MHz\fP number of cycles executed divided by time elapsed.
  78. \fBBusy%\fP percent of the interval that the CPU retired instructions, aka. % of time in "C0" state.
  79. \fBBzy_MHz\fP average clock rate while the CPU was busy (in "c0" state).
  80. \fBTSC_MHz\fP average MHz that the TSC ran during the entire interval.
  81. .fi
  82. .PP
  83. .SH DEBUG FIELD DESCRIPTIONS
  84. .nf
  85. \fBPackage\fP processor package number.
  86. \fBCore\fP processor core number.
  87. Note that multiple CPUs per core indicate support for Intel(R) Hyper-Threading Technology (HT).
  88. \fBCPU%c1, CPU%c3, CPU%c6, CPU%c7\fP show the percentage residency in hardware core idle states.
  89. \fBCoreTmp\fP Degrees Celsius reported by the per-core Digital Thermal Sensor.
  90. \fBPkgTtmp\fP Degrees Celsius reported by the per-package Package Thermal Monitor.
  91. \fBPkg%pc2, Pkg%pc3, Pkg%pc6, Pkg%pc7\fP percentage residency in hardware package idle states.
  92. \fBPkgWatt\fP Watts consumed by the whole package.
  93. \fBCorWatt\fP Watts consumed by the core part of the package.
  94. \fBGFXWatt\fP Watts consumed by the Graphics part of the package -- available only on client processors.
  95. \fBRAMWatt\fP Watts consumed by the DRAM DIMMS -- available only on server processors.
  96. \fBPKG_%\fP percent of the interval that RAPL throttling was active on the Package.
  97. \fBRAM_%\fP percent of the interval that RAPL throttling was active on DRAM.
  98. .fi
  99. .PP
  100. .SH PERIODIC EXAMPLE
  101. Without any parameters, turbostat displays statistics ever 5 seconds.
  102. Periodic output goes to stdout, by default, unless --out is used to specify an output file.
  103. The 5-second interval can be changed with th "-i sec" option.
  104. Or a command may be specified as in "FORK EXAMPLE" below.
  105. .nf
  106. [root@hsw]# ./turbostat
  107. CPU Avg_MHz Busy% Bzy_MHz TSC_MHz
  108. - 488 12.51 3898 3498
  109. 0 0 0.01 3885 3498
  110. 4 3897 99.99 3898 3498
  111. 1 0 0.00 3861 3498
  112. 5 0 0.00 3882 3498
  113. 2 1 0.02 3894 3498
  114. 6 2 0.06 3898 3498
  115. 3 0 0.00 3849 3498
  116. 7 0 0.00 3877 3498
  117. .fi
  118. .SH DEBUG EXAMPLE
  119. The "--debug" option prints additional system information before measurements:
  120. The first row of statistics is a summary for the entire system.
  121. For residency % columns, the summary is a weighted average.
  122. For Temperature columns, the summary is the column maximum.
  123. For Watts columns, the summary is a system total.
  124. Subsequent rows show per-CPU statistics.
  125. .nf
  126. turbostat version 4.1 10-Feb, 2015 - Len Brown <lenb@kernel.org>
  127. CPUID(0): GenuineIntel 13 CPUID levels; family:model:stepping 0x6:3c:3 (6:60:3)
  128. CPUID(6): APERF, DTS, PTM, EPB
  129. RAPL: 3121 sec. Joule Counter Range, at 84 Watts
  130. cpu0: MSR_NHM_PLATFORM_INFO: 0x80838f3012300
  131. 8 * 100 = 800 MHz max efficiency
  132. 35 * 100 = 3500 MHz TSC frequency
  133. cpu0: MSR_IA32_POWER_CTL: 0x0004005d (C1E auto-promotion: DISabled)
  134. cpu0: MSR_NHM_SNB_PKG_CST_CFG_CTL: 0x1e000400 (UNdemote-C3, UNdemote-C1, demote-C3, demote-C1, UNlocked: pkg-cstate-limit=0: pc0)
  135. cpu0: MSR_TURBO_RATIO_LIMIT: 0x25262727
  136. 37 * 100 = 3700 MHz max turbo 4 active cores
  137. 38 * 100 = 3800 MHz max turbo 3 active cores
  138. 39 * 100 = 3900 MHz max turbo 2 active cores
  139. 39 * 100 = 3900 MHz max turbo 1 active cores
  140. cpu0: MSR_IA32_ENERGY_PERF_BIAS: 0x00000006 (balanced)
  141. cpu0: MSR_CORE_PERF_LIMIT_REASONS, 0x31200000 (Active: ) (Logged: Auto-HWP, Amps, MultiCoreTurbo, Transitions, )
  142. cpu0: MSR_GFX_PERF_LIMIT_REASONS, 0x00000000 (Active: ) (Logged: )
  143. cpu0: MSR_RING_PERF_LIMIT_REASONS, 0x0d000000 (Active: ) (Logged: Amps, PkgPwrL1, PkgPwrL2, )
  144. cpu0: MSR_RAPL_POWER_UNIT: 0x000a0e03 (0.125000 Watts, 0.000061 Joules, 0.000977 sec.)
  145. cpu0: MSR_PKG_POWER_INFO: 0x000002a0 (84 W TDP, RAPL 0 - 0 W, 0.000000 sec.)
  146. cpu0: MSR_PKG_POWER_LIMIT: 0x428348001a82a0 (UNlocked)
  147. cpu0: PKG Limit #1: ENabled (84.000000 Watts, 8.000000 sec, clamp DISabled)
  148. cpu0: PKG Limit #2: ENabled (105.000000 Watts, 0.002441* sec, clamp DISabled)
  149. cpu0: MSR_PP0_POLICY: 0
  150. cpu0: MSR_PP0_POWER_LIMIT: 0x00000000 (UNlocked)
  151. cpu0: Cores Limit: DISabled (0.000000 Watts, 0.000977 sec, clamp DISabled)
  152. cpu0: MSR_PP1_POLICY: 0
  153. cpu0: MSR_PP1_POWER_LIMIT: 0x00000000 (UNlocked)
  154. cpu0: GFX Limit: DISabled (0.000000 Watts, 0.000977 sec, clamp DISabled)
  155. cpu0: MSR_IA32_TEMPERATURE_TARGET: 0x00641400 (100 C)
  156. cpu0: MSR_IA32_PACKAGE_THERM_STATUS: 0x88340800 (48 C)
  157. cpu0: MSR_IA32_THERM_STATUS: 0x88340000 (48 C +/- 1)
  158. cpu1: MSR_IA32_THERM_STATUS: 0x88440000 (32 C +/- 1)
  159. cpu2: MSR_IA32_THERM_STATUS: 0x88450000 (31 C +/- 1)
  160. cpu3: MSR_IA32_THERM_STATUS: 0x88490000 (27 C +/- 1)
  161. Core CPU Avg_MHz Busy% Bzy_MHz TSC_MHz SMI CPU%c1 CPU%c3 CPU%c6 CPU%c7 CoreTmp PkgTmp PkgWatt CorWatt GFXWatt
  162. - - 493 12.64 3898 3498 0 12.64 0.00 0.00 74.72 47 47 21.62 13.74 0.00
  163. 0 0 4 0.11 3894 3498 0 99.89 0.00 0.00 0.00 47 47 21.62 13.74 0.00
  164. 0 4 3897 99.98 3898 3498 0 0.02
  165. 1 1 7 0.17 3887 3498 0 0.04 0.00 0.00 99.79 32
  166. 1 5 0 0.00 3885 3498 0 0.21
  167. 2 2 29 0.76 3895 3498 0 0.10 0.01 0.01 99.13 32
  168. 2 6 2 0.06 3896 3498 0 0.80
  169. 3 3 1 0.02 3832 3498 0 0.03 0.00 0.00 99.95 28
  170. 3 7 0 0.00 3879 3498 0 0.04
  171. ^C
  172. .fi
  173. The \fBmax efficiency\fP frequency, a.k.a. Low Frequency Mode, is the frequency
  174. available at the minimum package voltage. The \fBTSC frequency\fP is the base
  175. frequency of the processor -- this should match the brand string
  176. in /proc/cpuinfo. This base frequency
  177. should be sustainable on all CPUs indefinitely, given nominal power and cooling.
  178. The remaining rows show what maximum turbo frequency is possible
  179. depending on the number of idle cores. Note that not all information is
  180. available on all processors.
  181. .PP
  182. The --debug option adds additional columns to the measurement ouput, including CPU idle power-state residency processor temperature sensor readinds.
  183. See the field definitions above.
  184. .SH FORK EXAMPLE
  185. If turbostat is invoked with a command, it will fork that command
  186. and output the statistics gathered after the command exits.
  187. In this case, turbostat output goes to stderr, by default.
  188. Output can instead be saved to a file using the --out option.
  189. eg. Here a cycle soaker is run on 1 CPU (see %c0) for a few seconds
  190. until ^C while the other CPUs are mostly idle:
  191. .nf
  192. root@hsw: turbostat cat /dev/zero > /dev/null
  193. ^C
  194. CPU Avg_MHz Busy% Bzy_MHz TSC_MHz
  195. - 482 12.51 3854 3498
  196. 0 0 0.01 1960 3498
  197. 4 0 0.00 2128 3498
  198. 1 0 0.00 3003 3498
  199. 5 3854 99.98 3855 3498
  200. 2 0 0.01 3504 3498
  201. 6 3 0.08 3884 3498
  202. 3 0 0.00 2553 3498
  203. 7 0 0.00 2126 3498
  204. 10.783983 sec
  205. .fi
  206. Above the cycle soaker drives cpu5 up its 3.9 GHz turbo limit.
  207. The first row shows the average MHz and Busy% across all the processors in the system.
  208. Note that the Avg_MHz column reflects the total number of cycles executed
  209. divided by the measurement interval. If the Busy% column is 100%,
  210. then the processor was running at that speed the entire interval.
  211. The Avg_MHz multiplied by the Busy% results in the Bzy_MHz --
  212. which is the average frequency while the processor was executing --
  213. not including any non-busy idle time.
  214. .SH NOTES
  215. .B "turbostat "
  216. must be run as root.
  217. Alternatively, non-root users can be enabled to run turbostat this way:
  218. # setcap cap_sys_rawio=ep ./turbostat
  219. # chmod +r /dev/cpu/*/msr
  220. .B "turbostat "
  221. reads hardware counters, but doesn't write them.
  222. So it will not interfere with the OS or other programs, including
  223. multiple invocations of itself.
  224. \fBturbostat \fP
  225. may work poorly on Linux-2.6.20 through 2.6.29,
  226. as \fBacpi-cpufreq \fPperiodically cleared the APERF and MPERF MSRs
  227. in those kernels.
  228. AVG_MHz = APERF_delta/measurement_interval. This is the actual
  229. number of elapsed cycles divided by the entire sample interval --
  230. including idle time. Note that this calculation is resilient
  231. to systems lacking a non-stop TSC.
  232. TSC_MHz = TSC_delta/measurement_interval.
  233. On a system with an invariant TSC, this value will be constant
  234. and will closely match the base frequency value shown
  235. in the brand string in /proc/cpuinfo. On a system where
  236. the TSC stops in idle, TSC_MHz will drop
  237. below the processor's base frequency.
  238. Busy% = MPERF_delta/TSC_delta
  239. Bzy_MHz = TSC_delta/APERF_delta/MPERF_delta/measurement_interval
  240. Note that these calculations depend on TSC_delta, so they
  241. are not reliable during intervals when TSC_MHz is not running at the base frequency.
  242. Turbostat data collection is not atomic.
  243. Extremely short measurement intervals (much less than 1 second),
  244. or system activity that prevents turbostat from being able
  245. to run on all CPUS to quickly collect data, will result in
  246. inconsistent results.
  247. The APERF, MPERF MSRs are defined to count non-halted cycles.
  248. Although it is not guaranteed by the architecture, turbostat assumes
  249. that they count at TSC rate, which is true on all processors tested to date.
  250. .SH REFERENCES
  251. Volume 3B: System Programming Guide"
  252. http://www.intel.com/products/processor/manuals/
  253. .SH FILES
  254. .ta
  255. .nf
  256. /dev/cpu/*/msr
  257. .fi
  258. .SH "SEE ALSO"
  259. msr(4), vmstat(8)
  260. .PP
  261. .SH AUTHOR
  262. .nf
  263. Written by Len Brown <len.brown@intel.com>