aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTodd E Brandt <todd.e.brandt@linux.intel.com>2017-04-07 14:05:37 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-04-19 17:26:41 -0400
commit22440373e11ad3fba0b33a9bded1531469a72551 (patch)
treee0dc01a4b21fa9e5326258a2ef125e52fc54a254
parentc4980cee82efb4fef8afac3675cb25fba3baca34 (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/Makefile28
-rw-r--r--tools/power/pm-graph/bootgraph.8132
-rw-r--r--tools/power/pm-graph/sleepgraph.8243
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 @@
1PREFIX ?= /usr
2DESTDIR ?=
3
4all:
5 @echo "Nothing to build"
6
7install :
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
19uninstall :
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
3bootgraph \- 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
11creates an html representation of the initcall timeline up to the start
12of the init process.
13.PP
14If no specific command is given, the tool reads the current dmesg log and
15outputs bootgraph.html.
16.PP
17The tool can also augment the timeline with ftrace data on custom target
18functions as well as full trace callgraphs.
19.SH OPTIONS
20.TP
21\fB-h\fR
22Print this help text
23.TP
24\fB-v\fR
25Print the current tool version
26.TP
27\fB-addlogs\fR
28Add the dmesg log to the html output. It will be viewable by
29clicking a button in the timeline.
30.TP
31\fB-o \fIfile\fR
32Override the HTML output filename (default: bootgraph.html)
33.SS "Ftrace Debug"
34.TP
35\fB-f\fR
36Use ftrace to add function detail (default: disabled)
37.TP
38\fB-callgraph\fR
39Use ftrace to create initcall callgraphs (default: disabled). If -filter
40is not used there will be one callgraph per initcall. This can produce
41very large outputs, i.e. 10MB - 100MB.
42.TP
43\fB-maxdepth \fIlevel\fR
44limit the callgraph trace depth to \fIlevel\fR (default: 2). This is
45the best way to limit the output size when using -callgraph.
46.TP
47\fB-mincg \fIt\fR
48Discard all callgraphs shorter than \fIt\fR milliseconds (default: 0=all).
49This reduces the html file size as there can be many tiny callgraphs
50which are barely visible in the timeline.
51The value is a float: e.g. 0.001 represents 1 us.
52.TP
53\fB-timeprec \fIn\fR
54Number of significant digits in timestamps (0:S, 3:ms, [6:us])
55.TP
56\fB-expandcg\fR
57pre-expand the callgraph data in the html output (default: disabled)
58.TP
59\fB-filter \fI"func1,func2,..."\fR
60Instead of tracing each initcall, trace a custom list of functions (default: do_one_initcall)
61
62.SH COMMANDS
63.TP
64\fB-reboot\fR
65Reboot 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
72Show 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
78Create HTML output from an existing dmesg file.
79.TP
80\fB-ftrace \fIfile\fR
81Create HTML output from an existing ftrace file (used with -dmesg).
82.TP
83\fB-flistall\fR
84Print all ftrace functions capable of being captured. These are all the
85possible values you can add to trace via the -filter argument.
86
87.SH EXAMPLES
88Create a timeline using the current dmesg log.
89.IP
90\f(CW$ bootgraph\fR
91.PP
92Create a timeline using the current dmesg and ftrace log.
93.IP
94\f(CW$ bootgraph -callgraph\fR
95.PP
96Create 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
100Capture a new boot timeline by automatically rebooting the machine.
101.IP
102\f(CW$ sudo bootgraph -reboot -addlogs -o latestboot.html\fR
103.PP
104Capture a new boot timeline with function trace data.
105.IP
106\f(CW$ sudo bootgraph -reboot -f\fR
107.PP
108Capture 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
112Capture 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
116Capture 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"
128dmesg(1), update-grub(8), crontab(1), reboot(8)
129.PP
130.SH AUTHOR
131.nf
132Written 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
3sleepgraph \- 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
11in optimizing their linux stack's suspend/resume time. Using a kernel
12image built with a few extra options enabled, the tool will execute a
13suspend and capture dmesg and ftrace data until resume is complete.
14This data is transformed into a device timeline and an optional
15callgraph to give a detailed view of which devices/subsystems are
16taking the most time in suspend/resume.
17.PP
18If no specific command is given, the default behavior is to initiate
19a suspend/resume.
20.PP
21Generates 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
28Print the help text.
29.TP
30\fB-v\fR
31Print the current tool version.
32.TP
33\fB-verbose\fR
34Print extra information during execution and analysis.
35.TP
36\fB-config \fIfile\fR
37Pull arguments and config options from a file.
38.TP
39\fB-m \fImode\fR
40Mode to initiate for suspend e.g. standby, freeze, mem (default: mem).
41.TP
42\fB-o \fIsubdir\fR
43Override the output subdirectory. Use {date}, {time}, {hostname} for current values.
44.sp
45e.g. suspend-{hostname}-{date}-{time}
46.TP
47\fB-rtcwake \fIt\fR | off
48Use rtcwake to autoresume after \fIt\fR seconds (default: 15). Set t to "off" to
49disable rtcwake and require a user keypress to resume.
50.TP
51\fB-addlogs\fR
52Add the dmesg and ftrace logs to the html output. They will be viewable by
53clicking buttons in the timeline.
54
55.SS "Advanced"
56.TP
57\fB-cmd \fIstr\fR
58Run the timeline over a custom suspend command, e.g. pm-suspend. By default
59the tool forces suspend via /sys/power/state so this allows testing over
60an OS's official suspend method. The output file will change to
61hostname_command.html and will autodetect which suspend mode was triggered.
62.TP
63\fB-filter \fI"d1,d2,..."\fR
64Filter out all but these device callbacks. These strings can be device names
65or module names. e.g. 0000:00:02.0, ata5, i915, usb, etc.
66.TP
67\fB-mindev \fIt\fR
68Discard all device callbacks shorter than \fIt\fR milliseconds (default: 0.0).
69This reduces the html file size as there can be many tiny callbacks which are barely
70visible. The value is a float: e.g. 0.001 represents 1 us.
71.TP
72\fB-proc\fR
73Add usermode process info into the timeline (default: disabled).
74.TP
75\fB-dev\fR
76Add kernel source calls and threads to the timeline (default: disabled).
77.TP
78\fB-x2\fR
79Run two suspend/resumes back to back (default: disabled).
80.TP
81\fB-x2delay \fIt\fR
82Include \fIt\fR ms delay between multiple test runs (default: 0 ms).
83.TP
84\fB-predelay \fIt\fR
85Include \fIt\fR ms delay before 1st suspend (default: 0 ms).
86.TP
87\fB-postdelay \fIt\fR
88Include \fIt\fR ms delay after last resume (default: 0 ms).
89.TP
90\fB-multi \fIn d\fR
91Execute \fIn\fR consecutive tests at \fId\fR seconds intervals. The outputs will
92be created in a new subdirectory with a summary page: suspend-xN-{date}-{time}.
93
94.SS "Ftrace Debug"
95.TP
96\fB-f\fR
97Use ftrace to create device callgraphs (default: disabled). This can produce
98very large outputs, i.e. 10MB - 100MB.
99.TP
100\fB-maxdepth \fIlevel\fR
101limit the callgraph trace depth to \fIlevel\fR (default: 0=all). This is
102the best way to limit the output size when using callgraphs via -f.
103.TP
104\fB-expandcg\fR
105pre-expand the callgraph data in the html output (default: disabled)
106.TP
107\fB-fadd \fIfile\fR
108Add functions to be graphed in the timeline from a list in a text file
109.TP
110\fB-mincg \fIt\fR
111Discard all callgraphs shorter than \fIt\fR milliseconds (default: 0.0).
112This reduces the html file size as there can be many tiny callgraphs
113which are barely visible in the timeline.
114The value is a float: e.g. 0.001 represents 1 us.
115.TP
116\fB-cgphase \fIp\fR
117Only show callgraph data for phase \fIp\fR (e.g. suspend_late).
118.TP
119\fB-cgtest \fIn\fR
120In an x2 run, only show callgraph data for test \fIn\fR (e.g. 0 or 1).
121.TP
122\fB-timeprec \fIn\fR
123Number of significant digits in timestamps (0:S, [3:ms], 6:us).
124
125.SH COMMANDS
126.TP
127\fB-ftrace \fIfile\fR
128Create HTML output from an existing ftrace file.
129.TP
130\fB-dmesg \fIfile\fR
131Create HTML output from an existing dmesg file.
132.TP
133\fB-summary \fIindir\fR
134Create a summary page of all tests in \fIindir\fR. Creates summary.html
135in the current folder. The output page is a table of tests with
136suspend and resume values sorted by suspend mode, host, and kernel.
137Includes test averages by mode and links to the test html files.
138.TP
139\fB-modes\fR
140List available suspend modes.
141.TP
142\fB-status\fR
143Test to see if the system is able to run this tool. Use this along
144with any options you intend to use to see if they will work.
145.TP
146\fB-fpdt\fR
147Print out the contents of the ACPI Firmware Performance Data Table.
148.TP
149\fB-usbtopo\fR
150Print out the current USB topology with power info.
151.TP
152\fB-usbauto\fR
153Enable autosuspend for all connected USB devices.
154.TP
155\fB-flist\fR
156Print the list of ftrace functions currently being captured. Functions
157that are not available as symbols in the current kernel are shown in red.
158By default, the tool traces a list of important suspend/resume functions
159in order to better fill out the timeline. If the user has added their own
160with -fadd they will also be checked.
161.TP
162\fB-flistall\fR
163Print all ftrace functions capable of being captured. These are all the
164possible values you can add to trace via the -fadd argument.
165
166.SH EXAMPLES
167.SS "Simple Commands"
168Check which suspend modes are currently supported.
169.IP
170\f(CW$ sleepgraph -modes\fR
171.PP
172Read the Firmware Performance Data Table (FPDT)
173.IP
174\f(CW$ sudo sleepgraph -fpdt\fR
175.PP
176Print out the current USB power topology
177.IP
178\f(CW$ sleepgraph -usbtopo
179.PP
180Verify that you can run a command with a set of arguments
181.IP
182\f(CW$ sudo sleepgraph -f -rtcwake 30 -status
183.PP
184Generate a summary of all timelines in a particular folder.
185.IP
186\f(CW$ sleepgraph -summary ~/workspace/myresults/\fR
187.PP
188Re-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"
194Execute 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
198Execute 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
202Execute 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"
208Execute 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
212Run 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
216Do 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
220Execute 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"
227Add 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
231Capture 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"
239dmesg(1)
240.PP
241.SH AUTHOR
242.nf
243Written by Todd Brandt <todd.e.brandt@linux.intel.com>