sleepgraph.8 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. .TH SLEEPGRAPH 8
  2. .SH NAME
  3. sleepgraph \- Suspend/Resume timing analysis
  4. .SH SYNOPSIS
  5. .ft B
  6. .B sleepgraph
  7. .RB [ OPTIONS ]
  8. .RB [ COMMAND ]
  9. .SH DESCRIPTION
  10. \fBsleepgraph \fP is designed to assist kernel and OS developers
  11. in optimizing their linux stack's suspend/resume time. Using a kernel
  12. image built with a few extra options enabled, the tool will execute a
  13. suspend and capture dmesg and ftrace data until resume is complete.
  14. This data is transformed into a device timeline and an optional
  15. callgraph to give a detailed view of which devices/subsystems are
  16. taking the most time in suspend/resume.
  17. .PP
  18. If no specific command is given, the default behavior is to initiate
  19. a suspend/resume.
  20. .PP
  21. Generates output files in subdirectory: suspend-yymmdd-HHMMSS
  22. html timeline : <hostname>_<mode>.html
  23. raw dmesg file : <hostname>_<mode>_dmesg.txt
  24. raw ftrace file : <hostname>_<mode>_ftrace.txt
  25. .SH OPTIONS
  26. .TP
  27. \fB-h\fR
  28. Print the help text.
  29. .TP
  30. \fB-v\fR
  31. Print the current tool version.
  32. .TP
  33. \fB-verbose\fR
  34. Print extra information during execution and analysis.
  35. .TP
  36. \fB-config \fIfile\fR
  37. Pull arguments and config options from a file.
  38. .TP
  39. \fB-m \fImode\fR
  40. Mode to initiate for suspend e.g. standby, freeze, mem (default: mem).
  41. .TP
  42. \fB-o \fIname\fR
  43. Overrides the output subdirectory name when running a new test.
  44. Use {date}, {time}, {hostname} for current values.
  45. .sp
  46. e.g. suspend-{hostname}-{date}-{time}
  47. .TP
  48. \fB-rtcwake \fIt\fR | off
  49. Use rtcwake to autoresume after \fIt\fR seconds (default: 15). Set t to "off" to
  50. disable rtcwake and require a user keypress to resume.
  51. .TP
  52. \fB-addlogs\fR
  53. Add the dmesg and ftrace logs to the html output. They will be viewable by
  54. clicking buttons in the timeline.
  55. .TP
  56. \fB-noturbostat\fR
  57. By default, if turbostat is found and the requested mode is freeze, sleepgraph
  58. will execute the suspend via turbostat and collect data in the timeline log.
  59. This option disables the use of turbostat.
  60. .TP
  61. \fB-result \fIfile\fR
  62. Export a results table to a text file for parsing.
  63. .TP
  64. \fB-sync\fR
  65. Sync the filesystems before starting the test. This reduces the size of
  66. the sys_sync call which happens in the suspend_prepare phase.
  67. .TP
  68. \fB-rs \fIenable/disable\fR
  69. During test, enable/disable runtime suspend for all devices. The test is delayed
  70. by 5 seconds to allow runtime suspend changes to occur. The settings are restored
  71. after the test is complete.
  72. .TP
  73. \fB-display \fIon/off/standby/suspend\fR
  74. Switch the display to the requested mode for the test using the xset command.
  75. This helps maintain the consistency of test data for better comparison.
  76. .TP
  77. \fB-skiphtml\fR
  78. Run the test and capture the trace logs, but skip the timeline generation.
  79. .SS "advanced"
  80. .TP
  81. \fB-gzip\fR
  82. Gzip the trace and dmesg logs to save space. The tool can also read in gzipped
  83. logs for processing.
  84. .TP
  85. \fB-cmd \fIstr\fR
  86. Run the timeline over a custom suspend command, e.g. pm-suspend. By default
  87. the tool forces suspend via /sys/power/state so this allows testing over
  88. an OS's official suspend method. The output file will change to
  89. hostname_command.html and will autodetect which suspend mode was triggered.
  90. .TP
  91. \fB-filter \fI"d1,d2,..."\fR
  92. Filter out all but these device callbacks. These strings can be device names
  93. or module names. e.g. 0000:00:02.0, ata5, i915, usb, etc.
  94. .TP
  95. \fB-mindev \fIt\fR
  96. Discard all device callbacks shorter than \fIt\fR milliseconds (default: 0.0).
  97. This reduces the html file size as there can be many tiny callbacks which are barely
  98. visible. The value is a float: e.g. 0.001 represents 1 us.
  99. .TP
  100. \fB-proc\fR
  101. Add usermode process info into the timeline (default: disabled).
  102. .TP
  103. \fB-dev\fR
  104. Add kernel source calls and threads to the timeline (default: disabled).
  105. .TP
  106. \fB-x2\fR
  107. Run two suspend/resumes back to back (default: disabled).
  108. .TP
  109. \fB-x2delay \fIt\fR
  110. Include \fIt\fR ms delay between multiple test runs (default: 0 ms).
  111. .TP
  112. \fB-predelay \fIt\fR
  113. Include \fIt\fR ms delay before 1st suspend (default: 0 ms).
  114. .TP
  115. \fB-postdelay \fIt\fR
  116. Include \fIt\fR ms delay after last resume (default: 0 ms).
  117. .TP
  118. \fB-multi \fIn d\fR
  119. Execute \fIn\fR consecutive tests at \fId\fR seconds intervals. The outputs will
  120. be created in a new subdirectory with a summary page: suspend-xN-{date}-{time}.
  121. .SS "ftrace debug"
  122. .TP
  123. \fB-f\fR
  124. Use ftrace to create device callgraphs (default: disabled). This can produce
  125. very large outputs, i.e. 10MB - 100MB.
  126. .TP
  127. \fB-ftop\fR
  128. Use ftrace on the top level call: "suspend_devices_and_enter" only (default: disabled).
  129. This option implies -f and creates a single callgraph covering all of suspend/resume.
  130. .TP
  131. \fB-maxdepth \fIlevel\fR
  132. limit the callgraph trace depth to \fIlevel\fR (default: 0=all). This is
  133. the best way to limit the output size when using callgraphs via -f.
  134. .TP
  135. \fB-expandcg\fR
  136. pre-expand the callgraph data in the html output (default: disabled)
  137. .TP
  138. \fB-fadd \fIfile\fR
  139. Add functions to be graphed in the timeline from a list in a text file
  140. .TP
  141. \fB-mincg \fIt\fR
  142. Discard all callgraphs shorter than \fIt\fR milliseconds (default: 0.0).
  143. This reduces the html file size as there can be many tiny callgraphs
  144. which are barely visible in the timeline.
  145. The value is a float: e.g. 0.001 represents 1 us.
  146. .TP
  147. \fB-cgfilter \fI"func1,func2,..."\fR
  148. Reduce callgraph output in the timeline by limiting it certain devices. The
  149. argument can be a single device name or a comma delimited list.
  150. (default: none)
  151. .TP
  152. \fB-cgskip \fIfile\fR
  153. Reduce callgraph timeline size by skipping over uninteresting functions
  154. in the trace, e.g. printk or console_unlock. The functions listed
  155. in this file will show up as empty leaves in the callgraph with only the start/end
  156. times displayed. cgskip.txt is used automatically if found in the path, so
  157. use "off" to disable completely (default: cgskip.txt)
  158. .TP
  159. \fB-cgphase \fIp\fR
  160. Only show callgraph data for phase \fIp\fR (e.g. suspend_late).
  161. .TP
  162. \fB-cgtest \fIn\fR
  163. In an x2 run, only show callgraph data for test \fIn\fR (e.g. 0 or 1).
  164. .TP
  165. \fB-timeprec \fIn\fR
  166. Number of significant digits in timestamps (0:S, [3:ms], 6:us).
  167. .TP
  168. \fB-bufsize \fIN\fR
  169. Set trace buffer size to N kilo-bytes (default: all of free memory up to 3GB)
  170. .SH COMMANDS
  171. .TP
  172. \fB-summary \fIindir\fR
  173. Create a summary page of all tests in \fIindir\fR. Creates summary.html
  174. in the current folder. The output page is a table of tests with
  175. suspend and resume values sorted by suspend mode, host, and kernel.
  176. Includes test averages by mode and links to the test html files.
  177. Use -genhtml to include tests with missing html.
  178. .TP
  179. \fB-modes\fR
  180. List available suspend modes.
  181. .TP
  182. \fB-status\fR
  183. Test to see if the system is able to run this tool. Use this along
  184. with any options you intend to use to see if they will work.
  185. .TP
  186. \fB-fpdt\fR
  187. Print out the contents of the ACPI Firmware Performance Data Table.
  188. .TP
  189. \fB-battery\fR
  190. Print out battery status and current charge.
  191. .TP
  192. \fB-wifi\fR
  193. Print out wifi status and connection details.
  194. .TP
  195. \fB-xon/-xoff/-xstandby/-xsuspend\fR
  196. Test xset by attempting to switch the display to the given mode. This
  197. is the same command which will be issued by \fB-display \fImode\fR.
  198. .TP
  199. \fB-xstat\fR
  200. Get the current DPMS display mode.
  201. .TP
  202. \fB-sysinfo\fR
  203. Print out system info extracted from BIOS. Reads /dev/mem directly instead of going through dmidecode.
  204. .TP
  205. \fB-devinfo\fR
  206. Print out the pm settings of all devices which support runtime suspend.
  207. .TP
  208. \fB-flist\fR
  209. Print the list of ftrace functions currently being captured. Functions
  210. that are not available as symbols in the current kernel are shown in red.
  211. By default, the tool traces a list of important suspend/resume functions
  212. in order to better fill out the timeline. If the user has added their own
  213. with -fadd they will also be checked.
  214. .TP
  215. \fB-flistall\fR
  216. Print all ftrace functions capable of being captured. These are all the
  217. possible values you can add to trace via the -fadd argument.
  218. .SS "rebuild"
  219. .TP
  220. \fB-ftrace \fIfile\fR
  221. Create HTML output from an existing ftrace file.
  222. .TP
  223. \fB-dmesg \fIfile\fR
  224. Create HTML output from an existing dmesg file.
  225. .SH EXAMPLES
  226. .SS "simple commands"
  227. Check which suspend modes are currently supported.
  228. .IP
  229. \f(CW$ sleepgraph -modes\fR
  230. .PP
  231. Read the Firmware Performance Data Table (FPDT)
  232. .IP
  233. \f(CW$ sudo sleepgraph -fpdt\fR
  234. .PP
  235. Print out the current USB power topology
  236. .IP
  237. \f(CW$ sleepgraph -usbtopo
  238. .PP
  239. Verify that you can run a command with a set of arguments
  240. .IP
  241. \f(CW$ sudo sleepgraph -f -rtcwake 30 -status
  242. .PP
  243. Generate a summary of all timelines in a particular folder.
  244. .IP
  245. \f(CW$ sleepgraph -summary ~/workspace/myresults/\fR
  246. .PP
  247. .SS "capturing basic timelines"
  248. Execute a mem suspend with a 15 second wakeup. Include the logs in the html.
  249. .IP
  250. \f(CW$ sudo sleepgraph -rtcwake 15 -addlogs\fR
  251. .PP
  252. Execute a standby with a 15 second wakeup. Change the output folder name.
  253. .IP
  254. \f(CW$ sudo sleepgraph -m standby -rtcwake 15 -o "standby-{host}-{date}-{time}"\fR
  255. .PP
  256. Execute a freeze with no wakeup (require keypress). Change output folder name.
  257. .IP
  258. \f(CW$ sudo sleepgraph -m freeze -rtcwake off -o "freeze-{hostname}-{date}-{time}"\fR
  259. .PP
  260. .SS "capturing advanced timelines"
  261. Execute a suspend & include dev mode source calls, limit callbacks to 5ms or larger.
  262. .IP
  263. \f(CW$ sudo sleepgraph -m mem -rtcwake 15 -dev -mindev 5\fR
  264. .PP
  265. Run two suspends back to back, include a 500ms delay before, after, and in between runs.
  266. .IP
  267. \f(CW$ sudo sleepgraph -m mem -rtcwake 15 -x2 -predelay 500 -x2delay 500 -postdelay 500\fR
  268. .PP
  269. Do a batch run of 10 freezes with 30 seconds delay between runs.
  270. .IP
  271. \f(CW$ sudo sleepgraph -m freeze -rtcwake 15 -multi 10 30\fR
  272. .PP
  273. Execute a suspend using a custom command.
  274. .IP
  275. \f(CW$ sudo sleepgraph -cmd "echo mem > /sys/power/state" -rtcwake 15\fR
  276. .PP
  277. .SS "adding callgraph data"
  278. Add device callgraphs. Limit the trace depth and only show callgraphs 10ms or larger.
  279. .IP
  280. \f(CW$ sudo sleepgraph -m mem -rtcwake 15 -f -maxdepth 5 -mincg 10\fR
  281. .PP
  282. Capture a full callgraph across all suspend, then filter the html by a single phase.
  283. .IP
  284. \f(CW$ sudo sleepgraph -m mem -rtcwake 15 -f\fR
  285. .IP
  286. \f(CW$ sleepgraph -dmesg host_mem_dmesg.txt -ftrace host_mem_ftrace.txt -f -cgphase resume
  287. .PP
  288. .SS "rebuild timeline from logs"
  289. .PP
  290. Rebuild the html from a previous run's logs, using the same options.
  291. .IP
  292. \f(CW$ sleepgraph -dmesg dmesg.txt -ftrace ftrace.txt -callgraph\fR
  293. .PP
  294. Rebuild the html with different options.
  295. .IP
  296. \f(CW$ sleepgraph -dmesg dmesg.txt -ftrace ftrace.txt -addlogs -srgap\fR
  297. .SH "SEE ALSO"
  298. dmesg(1)
  299. .PP
  300. .SH AUTHOR
  301. .nf
  302. Written by Todd Brandt <todd.e.brandt@linux.intel.com>