3 sleepgraph \- Suspend/Resume timing analysis
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.
18 If no specific command is given, the default behavior is to initiate
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
31 Print the current tool version.
34 Print extra information during execution and analysis.
37 Pull arguments and config options from a file.
40 Mode to initiate for suspend e.g. standby, freeze, mem (default: mem).
43 Overrides the output subdirectory name when running a new test.
44 Use {date}, {time}, {hostname} for current values.
46 e.g. suspend-{hostname}-{date}-{time}
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.
53 Add the dmesg and ftrace logs to the html output. They will be viewable by
54 clicking buttons in the timeline.
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.
62 Export a results table to a text file for parsing.
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.
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.
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.
78 Run the test and capture the trace logs, but skip the timeline generation.
83 Gzip the trace and dmesg logs to save space. The tool can also read in gzipped
87 Run the timeline over a custom suspend command, e.g. pm-suspend. By default
88 the tool forces suspend via /sys/power/state so this allows testing over
89 an OS's official suspend method. The output file will change to
90 hostname_command.html and will autodetect which suspend mode was triggered.
92 \fB-filter \fI"d1,d2,..."\fR
93 Filter out all but these device callbacks. These strings can be device names
94 or module names. e.g. 0000:00:02.0, ata5, i915, usb, etc.
97 Discard all device callbacks shorter than \fIt\fR milliseconds (default: 0.0).
98 This reduces the html file size as there can be many tiny callbacks which are barely
99 visible. The value is a float: e.g. 0.001 represents 1 us.
102 Add usermode process info into the timeline (default: disabled).
105 Add kernel source calls and threads to the timeline (default: disabled).
108 Run two suspend/resumes back to back (default: disabled).
111 Include \fIt\fR ms delay between multiple test runs (default: 0 ms).
114 Include \fIt\fR ms delay before 1st suspend (default: 0 ms).
116 \fB-postdelay \fIt\fR
117 Include \fIt\fR ms delay after last resume (default: 0 ms).
120 Execute \fIn\fR consecutive tests at \fId\fR seconds intervals. The outputs will
121 be created in a new subdirectory with a summary page: suspend-xN-{date}-{time}.
126 Use ftrace to create device callgraphs (default: disabled). This can produce
127 very large outputs, i.e. 10MB - 100MB.
130 Use ftrace on the top level call: "suspend_devices_and_enter" only (default: disabled).
131 This option implies -f and creates a single callgraph covering all of suspend/resume.
133 \fB-maxdepth \fIlevel\fR
134 limit the callgraph trace depth to \fIlevel\fR (default: 0=all). This is
135 the best way to limit the output size when using callgraphs via -f.
138 pre-expand the callgraph data in the html output (default: disabled)
141 Add functions to be graphed in the timeline from a list in a text file
144 Discard all callgraphs shorter than \fIt\fR milliseconds (default: 0.0).
145 This reduces the html file size as there can be many tiny callgraphs
146 which are barely visible in the timeline.
147 The value is a float: e.g. 0.001 represents 1 us.
149 \fB-cgfilter \fI"func1,func2,..."\fR
150 Reduce callgraph output in the timeline by limiting it certain devices. The
151 argument can be a single device name or a comma delimited list.
154 \fB-cgskip \fIfile\fR
155 Reduce callgraph timeline size by skipping over uninteresting functions
156 in the trace, e.g. printk or console_unlock. The functions listed
157 in this file will show up as empty leaves in the callgraph with only the start/end
158 times displayed. cgskip.txt is used automatically if found in the path, so
159 use "off" to disable completely (default: cgskip.txt)
162 Only show callgraph data for phase \fIp\fR (e.g. suspend_late).
165 In an x2 run, only show callgraph data for test \fIn\fR (e.g. 0 or 1).
168 Number of significant digits in timestamps (0:S, [3:ms], 6:us).
171 Set trace buffer size to N kilo-bytes (default: all of free memory up to 3GB)
175 \fB-summary \fIindir\fR
176 Create a summary page of all tests in \fIindir\fR. Creates summary.html
177 in the current folder. The output page is a table of tests with
178 suspend and resume values sorted by suspend mode, host, and kernel.
179 Includes test averages by mode and links to the test html files.
180 Use -genhtml to include tests with missing html.
183 List available suspend modes.
186 Test to see if the system is able to run this tool. Use this along
187 with any options you intend to use to see if they will work.
190 Print out the contents of the ACPI Firmware Performance Data Table.
193 Print out battery status and current charge.
196 Print out wifi status and connection details.
198 \fB-xon/-xoff/-xstandby/-xsuspend\fR
199 Test xset by attempting to switch the display to the given mode. This
200 is the same command which will be issued by \fB-display \fImode\fR.
203 Get the current DPMS display mode.
206 Print out system info extracted from BIOS. Reads /dev/mem directly instead of going through dmidecode.
209 Print out the pm settings of all devices which support runtime suspend.
212 Print the list of ftrace functions currently being captured. Functions
213 that are not available as symbols in the current kernel are shown in red.
214 By default, the tool traces a list of important suspend/resume functions
215 in order to better fill out the timeline. If the user has added their own
216 with -fadd they will also be checked.
219 Print all ftrace functions capable of being captured. These are all the
220 possible values you can add to trace via the -fadd argument.
223 \fB-ftrace \fIfile\fR
224 Create HTML output from an existing ftrace file.
227 Create HTML output from an existing dmesg file.
230 .SS "simple commands"
231 Check which suspend modes are currently supported.
233 \f(CW$ sleepgraph -modes\fR
235 Read the Firmware Performance Data Table (FPDT)
237 \f(CW$ sudo sleepgraph -fpdt\fR
239 Print out the current USB power topology
241 \f(CW$ sleepgraph -usbtopo
243 Verify that you can run a command with a set of arguments
245 \f(CW$ sudo sleepgraph -f -rtcwake 30 -status
247 Generate a summary of all timelines in a particular folder.
249 \f(CW$ sleepgraph -summary ~/workspace/myresults/\fR
252 .SS "capturing basic timelines"
253 Execute a mem suspend with a 15 second wakeup. Include the logs in the html.
255 \f(CW$ sudo sleepgraph -rtcwake 15 -addlogs\fR
257 Execute a standby with a 15 second wakeup. Change the output folder name.
259 \f(CW$ sudo sleepgraph -m standby -rtcwake 15 -o "standby-{host}-{date}-{time}"\fR
261 Execute a freeze with no wakeup (require keypress). Change output folder name.
263 \f(CW$ sudo sleepgraph -m freeze -rtcwake off -o "freeze-{hostname}-{date}-{time}"\fR
266 .SS "capturing advanced timelines"
267 Execute a suspend & include dev mode source calls, limit callbacks to 5ms or larger.
269 \f(CW$ sudo sleepgraph -m mem -rtcwake 15 -dev -mindev 5\fR
271 Run two suspends back to back, include a 500ms delay before, after, and in between runs.
273 \f(CW$ sudo sleepgraph -m mem -rtcwake 15 -x2 -predelay 500 -x2delay 500 -postdelay 500\fR
275 Do a batch run of 10 freezes with 30 seconds delay between runs.
277 \f(CW$ sudo sleepgraph -m freeze -rtcwake 15 -multi 10 30\fR
279 Execute a suspend using a custom command.
281 \f(CW$ sudo sleepgraph -cmd "echo mem > /sys/power/state" -rtcwake 15\fR
284 .SS "adding callgraph data"
285 Add device callgraphs. Limit the trace depth and only show callgraphs 10ms or larger.
287 \f(CW$ sudo sleepgraph -m mem -rtcwake 15 -f -maxdepth 5 -mincg 10\fR
289 Capture a full callgraph across all suspend, then filter the html by a single phase.
291 \f(CW$ sudo sleepgraph -m mem -rtcwake 15 -f\fR
293 \f(CW$ sleepgraph -dmesg host_mem_dmesg.txt -ftrace host_mem_ftrace.txt -f -cgphase resume
296 .SS "rebuild timeline from logs"
298 Rebuild the html from a previous run's logs, using the same options.
300 \f(CW$ sleepgraph -dmesg dmesg.txt -ftrace ftrace.txt -callgraph\fR
302 Rebuild the html with different options.
304 \f(CW$ sleepgraph -dmesg dmesg.txt -ftrace ftrace.txt -addlogs -srgap\fR
311 Written by Todd Brandt <todd.e.brandt@linux.intel.com>