diff options
author | Todd E Brandt <todd.e.brandt@linux.intel.com> | 2017-04-07 14:05:37 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-04-19 17:26:41 -0400 |
commit | 22440373e11ad3fba0b33a9bded1531469a72551 (patch) | |
tree | e0dc01a4b21fa9e5326258a2ef125e52fc54a254 | |
parent | c4980cee82efb4fef8afac3675cb25fba3baca34 (diff) |
tools: power: pm-graph: Package makefile and man pages
BootGraph and SleepGraph man pages
- includes full descriptions of tool arguments and commands
- includes examples of common use cases
Makefile
- no build required, used only for install
- installs man pages and tools as libraries with links
- includes an uninstall
Signed-off-by: Todd Brandt <todd.e.brandt@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | tools/power/pm-graph/Makefile | 28 | ||||
-rw-r--r-- | tools/power/pm-graph/bootgraph.8 | 132 | ||||
-rw-r--r-- | tools/power/pm-graph/sleepgraph.8 | 243 |
3 files changed, 403 insertions, 0 deletions
diff --git a/tools/power/pm-graph/Makefile b/tools/power/pm-graph/Makefile new file mode 100644 index 000000000000..4d0ccc89e6c6 --- /dev/null +++ b/tools/power/pm-graph/Makefile | |||
@@ -0,0 +1,28 @@ | |||
1 | PREFIX ?= /usr | ||
2 | DESTDIR ?= | ||
3 | |||
4 | all: | ||
5 | @echo "Nothing to build" | ||
6 | |||
7 | install : | ||
8 | install -d $(DESTDIR)$(PREFIX)/lib/pm-graph | ||
9 | install analyze_suspend.py $(DESTDIR)$(PREFIX)/lib/pm-graph | ||
10 | install analyze_boot.py $(DESTDIR)$(PREFIX)/lib/pm-graph | ||
11 | |||
12 | ln -s $(DESTDIR)$(PREFIX)/lib/pm-graph/analyze_boot.py $(DESTDIR)$(PREFIX)/bin/bootgraph | ||
13 | ln -s $(DESTDIR)$(PREFIX)/lib/pm-graph/analyze_suspend.py $(DESTDIR)$(PREFIX)/bin/sleepgraph | ||
14 | |||
15 | install -d $(DESTDIR)$(PREFIX)/share/man/man8 | ||
16 | install bootgraph.8 $(DESTDIR)$(PREFIX)/share/man/man8 | ||
17 | install sleepgraph.8 $(DESTDIR)$(PREFIX)/share/man/man8 | ||
18 | |||
19 | uninstall : | ||
20 | rm $(DESTDIR)$(PREFIX)/share/man/man8/bootgraph.8 | ||
21 | rm $(DESTDIR)$(PREFIX)/share/man/man8/sleepgraph.8 | ||
22 | |||
23 | rm $(DESTDIR)$(PREFIX)/bin/bootgraph | ||
24 | rm $(DESTDIR)$(PREFIX)/bin/sleepgraph | ||
25 | |||
26 | rm $(DESTDIR)$(PREFIX)/lib/pm-graph/analyze_boot.py | ||
27 | rm $(DESTDIR)$(PREFIX)/lib/pm-graph/analyze_suspend.py | ||
28 | rmdir $(DESTDIR)$(PREFIX)/lib/pm-graph | ||
diff --git a/tools/power/pm-graph/bootgraph.8 b/tools/power/pm-graph/bootgraph.8 new file mode 100644 index 000000000000..55272a67b0e7 --- /dev/null +++ b/tools/power/pm-graph/bootgraph.8 | |||
@@ -0,0 +1,132 @@ | |||
1 | .TH BOOTGRAPH 8 | ||
2 | .SH NAME | ||
3 | bootgraph \- Kernel boot timing analysis | ||
4 | .SH SYNOPSIS | ||
5 | .ft B | ||
6 | .B bootgraph | ||
7 | .RB [ OPTIONS ] | ||
8 | .RB [ COMMAND ] | ||
9 | .SH DESCRIPTION | ||
10 | \fBbootgraph \fP reads the dmesg log from kernel boot and | ||
11 | creates an html representation of the initcall timeline up to the start | ||
12 | of the init process. | ||
13 | .PP | ||
14 | If no specific command is given, the tool reads the current dmesg log and | ||
15 | outputs bootgraph.html. | ||
16 | .PP | ||
17 | The tool can also augment the timeline with ftrace data on custom target | ||
18 | functions as well as full trace callgraphs. | ||
19 | .SH OPTIONS | ||
20 | .TP | ||
21 | \fB-h\fR | ||
22 | Print this help text | ||
23 | .TP | ||
24 | \fB-v\fR | ||
25 | Print the current tool version | ||
26 | .TP | ||
27 | \fB-addlogs\fR | ||
28 | Add the dmesg log to the html output. It will be viewable by | ||
29 | clicking a button in the timeline. | ||
30 | .TP | ||
31 | \fB-o \fIfile\fR | ||
32 | Override the HTML output filename (default: bootgraph.html) | ||
33 | .SS "Ftrace Debug" | ||
34 | .TP | ||
35 | \fB-f\fR | ||
36 | Use ftrace to add function detail (default: disabled) | ||
37 | .TP | ||
38 | \fB-callgraph\fR | ||
39 | Use ftrace to create initcall callgraphs (default: disabled). If -filter | ||
40 | is not used there will be one callgraph per initcall. This can produce | ||
41 | very large outputs, i.e. 10MB - 100MB. | ||
42 | .TP | ||
43 | \fB-maxdepth \fIlevel\fR | ||
44 | limit the callgraph trace depth to \fIlevel\fR (default: 2). This is | ||
45 | the best way to limit the output size when using -callgraph. | ||
46 | .TP | ||
47 | \fB-mincg \fIt\fR | ||
48 | Discard all callgraphs shorter than \fIt\fR milliseconds (default: 0=all). | ||
49 | This reduces the html file size as there can be many tiny callgraphs | ||
50 | which are barely visible in the timeline. | ||
51 | The value is a float: e.g. 0.001 represents 1 us. | ||
52 | .TP | ||
53 | \fB-timeprec \fIn\fR | ||
54 | Number of significant digits in timestamps (0:S, 3:ms, [6:us]) | ||
55 | .TP | ||
56 | \fB-expandcg\fR | ||
57 | pre-expand the callgraph data in the html output (default: disabled) | ||
58 | .TP | ||
59 | \fB-filter \fI"func1,func2,..."\fR | ||
60 | Instead of tracing each initcall, trace a custom list of functions (default: do_one_initcall) | ||
61 | |||
62 | .SH COMMANDS | ||
63 | .TP | ||
64 | \fB-reboot\fR | ||
65 | Reboot the machine and generate a new timeline automatically. Works in 4 steps. | ||
66 | 1. updates grub with the required kernel parameters | ||
67 | 2. installs a cron job which re-runs the tool after reboot | ||
68 | 3. reboots the system | ||
69 | 4. after startup, extracts the data and generates the timeline | ||
70 | .TP | ||
71 | \fB-manual\fR | ||
72 | Show the requirements to generate a new timeline manually. Requires 3 steps. | ||
73 | 1. append the string to the kernel command line via your native boot manager. | ||
74 | 2. reboot the system | ||
75 | 3. after startup, re-run the tool with the same arguments and no command | ||
76 | .TP | ||
77 | \fB-dmesg \fIfile\fR | ||
78 | Create HTML output from an existing dmesg file. | ||
79 | .TP | ||
80 | \fB-ftrace \fIfile\fR | ||
81 | Create HTML output from an existing ftrace file (used with -dmesg). | ||
82 | .TP | ||
83 | \fB-flistall\fR | ||
84 | Print all ftrace functions capable of being captured. These are all the | ||
85 | possible values you can add to trace via the -filter argument. | ||
86 | |||
87 | .SH EXAMPLES | ||
88 | Create a timeline using the current dmesg log. | ||
89 | .IP | ||
90 | \f(CW$ bootgraph\fR | ||
91 | .PP | ||
92 | Create a timeline using the current dmesg and ftrace log. | ||
93 | .IP | ||
94 | \f(CW$ bootgraph -callgraph\fR | ||
95 | .PP | ||
96 | Create a timeline using the current dmesg, add the log to the html and change the name. | ||
97 | .IP | ||
98 | \f(CW$ bootgraph -addlogs -o myboot.html\fR | ||
99 | .PP | ||
100 | Capture a new boot timeline by automatically rebooting the machine. | ||
101 | .IP | ||
102 | \f(CW$ sudo bootgraph -reboot -addlogs -o latestboot.html\fR | ||
103 | .PP | ||
104 | Capture a new boot timeline with function trace data. | ||
105 | .IP | ||
106 | \f(CW$ sudo bootgraph -reboot -f\fR | ||
107 | .PP | ||
108 | Capture a new boot timeline with trace & callgraph data. Skip callgraphs smaller than 5ms. | ||
109 | .IP | ||
110 | \f(CW$ sudo bootgraph -reboot -callgraph -mincg 5\fR | ||
111 | .PP | ||
112 | Capture a new boot timeline with callgraph data over custom functions. | ||
113 | .IP | ||
114 | \f(CW$ sudo bootgraph -reboot -callgraph -filter "acpi_ps_parse_aml,msleep"\fR | ||
115 | .PP | ||
116 | Capture a brand new boot timeline with manual reboot. | ||
117 | .IP | ||
118 | \f(CW$ sudo bootgraph -callgraph -manual\fR | ||
119 | .IP | ||
120 | \f(CW$ vi /etc/default/grub # add the CMDLINE string to your kernel params\fR | ||
121 | .IP | ||
122 | \f(CW$ sudo reboot # reboot the machine\fR | ||
123 | .IP | ||
124 | \f(CW$ sudo bootgraph -callgraph # re-run the tool after restart\fR | ||
125 | .PP | ||
126 | |||
127 | .SH "SEE ALSO" | ||
128 | dmesg(1), update-grub(8), crontab(1), reboot(8) | ||
129 | .PP | ||
130 | .SH AUTHOR | ||
131 | .nf | ||
132 | Written by Todd Brandt <todd.e.brandt@linux.intel.com> | ||
diff --git a/tools/power/pm-graph/sleepgraph.8 b/tools/power/pm-graph/sleepgraph.8 new file mode 100644 index 000000000000..610e72ebbc06 --- /dev/null +++ b/tools/power/pm-graph/sleepgraph.8 | |||
@@ -0,0 +1,243 @@ | |||
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 \fIsubdir\fR | ||
43 | Override the output subdirectory. Use {date}, {time}, {hostname} for current values. | ||
44 | .sp | ||
45 | e.g. suspend-{hostname}-{date}-{time} | ||
46 | .TP | ||
47 | \fB-rtcwake \fIt\fR | off | ||
48 | Use rtcwake to autoresume after \fIt\fR seconds (default: 15). Set t to "off" to | ||
49 | disable rtcwake and require a user keypress to resume. | ||
50 | .TP | ||
51 | \fB-addlogs\fR | ||
52 | Add the dmesg and ftrace logs to the html output. They will be viewable by | ||
53 | clicking buttons in the timeline. | ||
54 | |||
55 | .SS "Advanced" | ||
56 | .TP | ||
57 | \fB-cmd \fIstr\fR | ||
58 | Run the timeline over a custom suspend command, e.g. pm-suspend. By default | ||
59 | the tool forces suspend via /sys/power/state so this allows testing over | ||
60 | an OS's official suspend method. The output file will change to | ||
61 | hostname_command.html and will autodetect which suspend mode was triggered. | ||
62 | .TP | ||
63 | \fB-filter \fI"d1,d2,..."\fR | ||
64 | Filter out all but these device callbacks. These strings can be device names | ||
65 | or module names. e.g. 0000:00:02.0, ata5, i915, usb, etc. | ||
66 | .TP | ||
67 | \fB-mindev \fIt\fR | ||
68 | Discard all device callbacks shorter than \fIt\fR milliseconds (default: 0.0). | ||
69 | This reduces the html file size as there can be many tiny callbacks which are barely | ||
70 | visible. The value is a float: e.g. 0.001 represents 1 us. | ||
71 | .TP | ||
72 | \fB-proc\fR | ||
73 | Add usermode process info into the timeline (default: disabled). | ||
74 | .TP | ||
75 | \fB-dev\fR | ||
76 | Add kernel source calls and threads to the timeline (default: disabled). | ||
77 | .TP | ||
78 | \fB-x2\fR | ||
79 | Run two suspend/resumes back to back (default: disabled). | ||
80 | .TP | ||
81 | \fB-x2delay \fIt\fR | ||
82 | Include \fIt\fR ms delay between multiple test runs (default: 0 ms). | ||
83 | .TP | ||
84 | \fB-predelay \fIt\fR | ||
85 | Include \fIt\fR ms delay before 1st suspend (default: 0 ms). | ||
86 | .TP | ||
87 | \fB-postdelay \fIt\fR | ||
88 | Include \fIt\fR ms delay after last resume (default: 0 ms). | ||
89 | .TP | ||
90 | \fB-multi \fIn d\fR | ||
91 | Execute \fIn\fR consecutive tests at \fId\fR seconds intervals. The outputs will | ||
92 | be created in a new subdirectory with a summary page: suspend-xN-{date}-{time}. | ||
93 | |||
94 | .SS "Ftrace Debug" | ||
95 | .TP | ||
96 | \fB-f\fR | ||
97 | Use ftrace to create device callgraphs (default: disabled). This can produce | ||
98 | very large outputs, i.e. 10MB - 100MB. | ||
99 | .TP | ||
100 | \fB-maxdepth \fIlevel\fR | ||
101 | limit the callgraph trace depth to \fIlevel\fR (default: 0=all). This is | ||
102 | the best way to limit the output size when using callgraphs via -f. | ||
103 | .TP | ||
104 | \fB-expandcg\fR | ||
105 | pre-expand the callgraph data in the html output (default: disabled) | ||
106 | .TP | ||
107 | \fB-fadd \fIfile\fR | ||
108 | Add functions to be graphed in the timeline from a list in a text file | ||
109 | .TP | ||
110 | \fB-mincg \fIt\fR | ||
111 | Discard all callgraphs shorter than \fIt\fR milliseconds (default: 0.0). | ||
112 | This reduces the html file size as there can be many tiny callgraphs | ||
113 | which are barely visible in the timeline. | ||
114 | The value is a float: e.g. 0.001 represents 1 us. | ||
115 | .TP | ||
116 | \fB-cgphase \fIp\fR | ||
117 | Only show callgraph data for phase \fIp\fR (e.g. suspend_late). | ||
118 | .TP | ||
119 | \fB-cgtest \fIn\fR | ||
120 | In an x2 run, only show callgraph data for test \fIn\fR (e.g. 0 or 1). | ||
121 | .TP | ||
122 | \fB-timeprec \fIn\fR | ||
123 | Number of significant digits in timestamps (0:S, [3:ms], 6:us). | ||
124 | |||
125 | .SH COMMANDS | ||
126 | .TP | ||
127 | \fB-ftrace \fIfile\fR | ||
128 | Create HTML output from an existing ftrace file. | ||
129 | .TP | ||
130 | \fB-dmesg \fIfile\fR | ||
131 | Create HTML output from an existing dmesg file. | ||
132 | .TP | ||
133 | \fB-summary \fIindir\fR | ||
134 | Create a summary page of all tests in \fIindir\fR. Creates summary.html | ||
135 | in the current folder. The output page is a table of tests with | ||
136 | suspend and resume values sorted by suspend mode, host, and kernel. | ||
137 | Includes test averages by mode and links to the test html files. | ||
138 | .TP | ||
139 | \fB-modes\fR | ||
140 | List available suspend modes. | ||
141 | .TP | ||
142 | \fB-status\fR | ||
143 | Test to see if the system is able to run this tool. Use this along | ||
144 | with any options you intend to use to see if they will work. | ||
145 | .TP | ||
146 | \fB-fpdt\fR | ||
147 | Print out the contents of the ACPI Firmware Performance Data Table. | ||
148 | .TP | ||
149 | \fB-usbtopo\fR | ||
150 | Print out the current USB topology with power info. | ||
151 | .TP | ||
152 | \fB-usbauto\fR | ||
153 | Enable autosuspend for all connected USB devices. | ||
154 | .TP | ||
155 | \fB-flist\fR | ||
156 | Print the list of ftrace functions currently being captured. Functions | ||
157 | that are not available as symbols in the current kernel are shown in red. | ||
158 | By default, the tool traces a list of important suspend/resume functions | ||
159 | in order to better fill out the timeline. If the user has added their own | ||
160 | with -fadd they will also be checked. | ||
161 | .TP | ||
162 | \fB-flistall\fR | ||
163 | Print all ftrace functions capable of being captured. These are all the | ||
164 | possible values you can add to trace via the -fadd argument. | ||
165 | |||
166 | .SH EXAMPLES | ||
167 | .SS "Simple Commands" | ||
168 | Check which suspend modes are currently supported. | ||
169 | .IP | ||
170 | \f(CW$ sleepgraph -modes\fR | ||
171 | .PP | ||
172 | Read the Firmware Performance Data Table (FPDT) | ||
173 | .IP | ||
174 | \f(CW$ sudo sleepgraph -fpdt\fR | ||
175 | .PP | ||
176 | Print out the current USB power topology | ||
177 | .IP | ||
178 | \f(CW$ sleepgraph -usbtopo | ||
179 | .PP | ||
180 | Verify that you can run a command with a set of arguments | ||
181 | .IP | ||
182 | \f(CW$ sudo sleepgraph -f -rtcwake 30 -status | ||
183 | .PP | ||
184 | Generate a summary of all timelines in a particular folder. | ||
185 | .IP | ||
186 | \f(CW$ sleepgraph -summary ~/workspace/myresults/\fR | ||
187 | .PP | ||
188 | Re-generate the html output from a previous run's dmesg and ftrace log. | ||
189 | .IP | ||
190 | \f(CW$ sleepgraph -dmesg myhost_mem_dmesg.txt -ftrace myhost_mem_ftrace.txt\fR | ||
191 | .PP | ||
192 | |||
193 | .SS "Capturing Simple Timelines" | ||
194 | Execute a mem suspend with a 15 second wakeup. Include the logs in the html. | ||
195 | .IP | ||
196 | \f(CW$ sudo sleepgraph -rtcwake 15 -addlogs\fR | ||
197 | .PP | ||
198 | Execute a standby with a 15 second wakeup. Change the output folder name. | ||
199 | .IP | ||
200 | \f(CW$ sudo sleepgraph -m standby -rtcwake 15 -o "standby-{hostname}-{date}-{time}"\fR | ||
201 | .PP | ||
202 | Execute a freeze with no wakeup (require keypress). Change output folder name. | ||
203 | .IP | ||
204 | \f(CW$ sudo sleepgraph -m freeze -rtcwake off -o "freeze-{hostname}-{date}-{time}"\fR | ||
205 | .PP | ||
206 | |||
207 | .SS "Capturing Advanced Timelines" | ||
208 | Execute a suspend & include dev mode source calls, limit callbacks to 5ms or larger. | ||
209 | .IP | ||
210 | \f(CW$ sudo sleepgraph -m mem -rtcwake 15 -dev -mindev 5\fR | ||
211 | .PP | ||
212 | Run two suspends back to back, include a 500ms delay before, after, and in between runs. | ||
213 | .IP | ||
214 | \f(CW$ sudo sleepgraph -m mem -rtcwake 15 -x2 -predelay 500 -x2delay 500 -postdelay 500\fR | ||
215 | .PP | ||
216 | Do a batch run of 10 freezes with 30 seconds delay between runs. | ||
217 | .IP | ||
218 | \f(CW$ sudo sleepgraph -m freeze -rtcwake 15 -multi 10 30\fR | ||
219 | .PP | ||
220 | Execute a suspend using a custom command. | ||
221 | .IP | ||
222 | \f(CW$ sudo sleepgraph -cmd "echo mem > /sys/power/state" -rtcwake 15\fR | ||
223 | .PP | ||
224 | |||
225 | |||
226 | .SS "Capturing Timelines with Callgraph Data" | ||
227 | Add device callgraphs. Limit the trace depth and only show callgraphs 10ms or larger. | ||
228 | .IP | ||
229 | \f(CW$ sudo sleepgraph -m mem -rtcwake 15 -f -maxdepth 5 -mincg 10\fR | ||
230 | .PP | ||
231 | Capture a full callgraph across all suspend, then filter the html by a single phase. | ||
232 | .IP | ||
233 | \f(CW$ sudo sleepgraph -m mem -rtcwake 15 -f\fR | ||
234 | .IP | ||
235 | \f(CW$ sleepgraph -dmesg host_mem_dmesg.txt -ftrace host_mem_ftrace.txt -f -cgphase resume | ||
236 | .PP | ||
237 | |||
238 | .SH "SEE ALSO" | ||
239 | dmesg(1) | ||
240 | .PP | ||
241 | .SH AUTHOR | ||
242 | .nf | ||
243 | Written by Todd Brandt <todd.e.brandt@linux.intel.com> | ||