Skip to content

Commit 2158e72

Browse files
tebrandtrafaeljw
authored andcommitted
pm-graph: package makefile and man pages
update help text and man pages for both tools - added more examples and separated them by category Makefile upgrades - uninstall: remove errors from uninstall if tool not found - install: perform uninstall before install Signed-off-by: Todd Brandt <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 370f4c2 commit 2158e72

File tree

3 files changed

+86
-42
lines changed

3 files changed

+86
-42
lines changed

tools/power/pm-graph/Makefile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ DESTDIR ?=
44
all:
55
@echo "Nothing to build"
66

7-
install :
7+
install : uninstall
88
install -d $(DESTDIR)$(PREFIX)/lib/pm-graph
99
install analyze_suspend.py $(DESTDIR)$(PREFIX)/lib/pm-graph
1010
install analyze_boot.py $(DESTDIR)$(PREFIX)/lib/pm-graph
@@ -17,12 +17,15 @@ install :
1717
install sleepgraph.8 $(DESTDIR)$(PREFIX)/share/man/man8
1818

1919
uninstall :
20-
rm $(DESTDIR)$(PREFIX)/share/man/man8/bootgraph.8
21-
rm $(DESTDIR)$(PREFIX)/share/man/man8/sleepgraph.8
20+
rm -f $(DESTDIR)$(PREFIX)/share/man/man8/bootgraph.8
21+
rm -f $(DESTDIR)$(PREFIX)/share/man/man8/sleepgraph.8
2222

23-
rm $(DESTDIR)$(PREFIX)/bin/bootgraph
24-
rm $(DESTDIR)$(PREFIX)/bin/sleepgraph
23+
rm -f $(DESTDIR)$(PREFIX)/bin/bootgraph
24+
rm -f $(DESTDIR)$(PREFIX)/bin/sleepgraph
2525

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
26+
rm -f $(DESTDIR)$(PREFIX)/lib/pm-graph/analyze_boot.py
27+
rm -f $(DESTDIR)$(PREFIX)/lib/pm-graph/analyze_suspend.py
28+
rm -f $(DESTDIR)$(PREFIX)/lib/pm-graph/*.pyc
29+
if [ -d $(DESTDIR)$(PREFIX)/lib/pm-graph ] ; then \
30+
rmdir $(DESTDIR)$(PREFIX)/lib/pm-graph; \
31+
fi;

tools/power/pm-graph/bootgraph.8

Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,23 @@ bootgraph \- Kernel boot timing analysis
88
.RB [ COMMAND ]
99
.SH DESCRIPTION
1010
\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.
11+
creates an html representation of the initcall timeline. It graphs
12+
every module init call found, through both kernel and user modes. The
13+
timeline is split into two phases: kernel mode & user mode. kernel mode
14+
represents a single process run on a single cpu with serial init calls.
15+
Once user mode begins, the init process is called, and the init calls
16+
start working in parallel.
1317
.PP
1418
If no specific command is given, the tool reads the current dmesg log and
15-
outputs bootgraph.html.
19+
outputs a new timeline.
1620
.PP
1721
The tool can also augment the timeline with ftrace data on custom target
1822
functions as well as full trace callgraphs.
23+
.PP
24+
Generates output files in subdirectory: boot-yymmdd-HHMMSS
25+
html timeline : <hostname>_boot.html
26+
raw dmesg file : <hostname>_boot_dmesg.txt
27+
raw ftrace file : <hostname>_boot_ftrace.txt
1928
.SH OPTIONS
2029
.TP
2130
\fB-h\fR
@@ -28,15 +37,18 @@ Print the current tool version
2837
Add the dmesg log to the html output. It will be viewable by
2938
clicking a button in the timeline.
3039
.TP
31-
\fB-o \fIfile\fR
32-
Override the HTML output filename (default: bootgraph.html)
33-
.SS "Ftrace Debug"
40+
\fB-o \fIname\fR
41+
Overrides the output subdirectory name when running a new test.
42+
Use {date}, {time}, {hostname} for current values.
43+
.sp
44+
e.g. boot-{hostname}-{date}-{time}
45+
.SS "advanced"
3446
.TP
3547
\fB-f\fR
3648
Use ftrace to add function detail (default: disabled)
3749
.TP
3850
\fB-callgraph\fR
39-
Use ftrace to create initcall callgraphs (default: disabled). If -filter
51+
Use ftrace to create initcall callgraphs (default: disabled). If -func
4052
is not used there will be one callgraph per initcall. This can produce
4153
very large outputs, i.e. 10MB - 100MB.
4254
.TP
@@ -50,16 +62,19 @@ This reduces the html file size as there can be many tiny callgraphs
5062
which are barely visible in the timeline.
5163
The value is a float: e.g. 0.001 represents 1 us.
5264
.TP
65+
\fB-cgfilter \fI"func1,func2,..."\fR
66+
Reduce callgraph output in the timeline by limiting it to a list of calls. The
67+
argument can be a single function name or a comma delimited list.
68+
(default: none)
69+
.TP
5370
\fB-timeprec \fIn\fR
5471
Number of significant digits in timestamps (0:S, 3:ms, [6:us])
5572
.TP
5673
\fB-expandcg\fR
5774
pre-expand the callgraph data in the html output (default: disabled)
5875
.TP
59-
\fB-filter \fI"func1,func2,..."\fR
76+
\fB-func \fI"func1,func2,..."\fR
6077
Instead of tracing each initcall, trace a custom list of functions (default: do_one_initcall)
61-
62-
.SH COMMANDS
6378
.TP
6479
\fB-reboot\fR
6580
Reboot the machine and generate a new timeline automatically. Works in 4 steps.
@@ -73,16 +88,23 @@ Show the requirements to generate a new timeline manually. Requires 3 steps.
7388
1. append the string to the kernel command line via your native boot manager.
7489
2. reboot the system
7590
3. after startup, re-run the tool with the same arguments and no command
91+
92+
.SH COMMANDS
93+
.SS "rebuild"
7694
.TP
7795
\fB-dmesg \fIfile\fR
7896
Create HTML output from an existing dmesg file.
7997
.TP
8098
\fB-ftrace \fIfile\fR
8199
Create HTML output from an existing ftrace file (used with -dmesg).
100+
.SS "other"
82101
.TP
83102
\fB-flistall\fR
84103
Print all ftrace functions capable of being captured. These are all the
85-
possible values you can add to trace via the -filter argument.
104+
possible values you can add to trace via the -func argument.
105+
.TP
106+
\fB-sysinfo\fR
107+
Print out system info extracted from BIOS. Reads /dev/mem directly instead of going through dmidecode.
86108

87109
.SH EXAMPLES
88110
Create a timeline using the current dmesg log.
@@ -93,13 +115,13 @@ Create a timeline using the current dmesg and ftrace log.
93115
.IP
94116
\f(CW$ bootgraph -callgraph\fR
95117
.PP
96-
Create a timeline using the current dmesg, add the log to the html and change the name.
118+
Create a timeline using the current dmesg, add the log to the html and change the folder.
97119
.IP
98-
\f(CW$ bootgraph -addlogs -o myboot.html\fR
120+
\f(CW$ bootgraph -addlogs -o "myboot-{date}-{time}"\fR
99121
.PP
100122
Capture a new boot timeline by automatically rebooting the machine.
101123
.IP
102-
\f(CW$ sudo bootgraph -reboot -addlogs -o latestboot.html\fR
124+
\f(CW$ sudo bootgraph -reboot -addlogs -o "latest-{hostname)"\fR
103125
.PP
104126
Capture a new boot timeline with function trace data.
105127
.IP
@@ -111,7 +133,7 @@ Capture a new boot timeline with trace & callgraph data. Skip callgraphs smaller
111133
.PP
112134
Capture a new boot timeline with callgraph data over custom functions.
113135
.IP
114-
\f(CW$ sudo bootgraph -reboot -callgraph -filter "acpi_ps_parse_aml,msleep"\fR
136+
\f(CW$ sudo bootgraph -reboot -callgraph -func "acpi_ps_parse_aml,msleep"\fR
115137
.PP
116138
Capture a brand new boot timeline with manual reboot.
117139
.IP
@@ -123,6 +145,15 @@ Capture a brand new boot timeline with manual reboot.
123145
.IP
124146
\f(CW$ sudo bootgraph -callgraph # re-run the tool after restart\fR
125147
.PP
148+
.SS "rebuild timeline from logs"
149+
.PP
150+
Rebuild the html from a previous run's logs, using the same options.
151+
.IP
152+
\f(CW$ bootgraph -dmesg dmesg.txt -ftrace ftrace.txt -callgraph\fR
153+
.PP
154+
Rebuild the html with different options.
155+
.IP
156+
\f(CW$ bootgraph -dmesg dmesg.txt -ftrace ftrace.txt -addlogs\fR
126157

127158
.SH "SEE ALSO"
128159
dmesg(1), update-grub(8), crontab(1), reboot(8)

tools/power/pm-graph/sleepgraph.8

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ Pull arguments and config options from a file.
3939
\fB-m \fImode\fR
4040
Mode to initiate for suspend e.g. standby, freeze, mem (default: mem).
4141
.TP
42-
\fB-o \fIsubdir\fR
43-
Override the output subdirectory. Use {date}, {time}, {hostname} for current values.
42+
\fB-o \fIname\fR
43+
Overrides the output subdirectory name when running a new test.
44+
Use {date}, {time}, {hostname} for current values.
4445
.sp
4546
e.g. suspend-{hostname}-{date}-{time}
4647
.TP
@@ -52,7 +53,7 @@ disable rtcwake and require a user keypress to resume.
5253
Add the dmesg and ftrace logs to the html output. They will be viewable by
5354
clicking buttons in the timeline.
5455

55-
.SS "Advanced"
56+
.SS "advanced"
5657
.TP
5758
\fB-cmd \fIstr\fR
5859
Run the timeline over a custom suspend command, e.g. pm-suspend. By default
@@ -91,7 +92,7 @@ Include \fIt\fR ms delay after last resume (default: 0 ms).
9192
Execute \fIn\fR consecutive tests at \fId\fR seconds intervals. The outputs will
9293
be created in a new subdirectory with a summary page: suspend-xN-{date}-{time}.
9394

94-
.SS "Ftrace Debug"
95+
.SS "ftrace debug"
9596
.TP
9697
\fB-f\fR
9798
Use ftrace to create device callgraphs (default: disabled). This can produce
@@ -124,12 +125,6 @@ Number of significant digits in timestamps (0:S, [3:ms], 6:us).
124125

125126
.SH COMMANDS
126127
.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
133128
\fB-summary \fIindir\fR
134129
Create a summary page of all tests in \fIindir\fR. Creates summary.html
135130
in the current folder. The output page is a table of tests with
@@ -146,6 +141,9 @@ with any options you intend to use to see if they will work.
146141
\fB-fpdt\fR
147142
Print out the contents of the ACPI Firmware Performance Data Table.
148143
.TP
144+
\fB-sysinfo\fR
145+
Print out system info extracted from BIOS. Reads /dev/mem directly instead of going through dmidecode.
146+
.TP
149147
\fB-usbtopo\fR
150148
Print out the current USB topology with power info.
151149
.TP
@@ -162,9 +160,16 @@ with -fadd they will also be checked.
162160
\fB-flistall\fR
163161
Print all ftrace functions capable of being captured. These are all the
164162
possible values you can add to trace via the -fadd argument.
163+
.SS "rebuild"
164+
.TP
165+
\fB-ftrace \fIfile\fR
166+
Create HTML output from an existing ftrace file.
167+
.TP
168+
\fB-dmesg \fIfile\fR
169+
Create HTML output from an existing dmesg file.
165170

166171
.SH EXAMPLES
167-
.SS "Simple Commands"
172+
.SS "simple commands"
168173
Check which suspend modes are currently supported.
169174
.IP
170175
\f(CW$ sleepgraph -modes\fR
@@ -185,12 +190,8 @@ Generate a summary of all timelines in a particular folder.
185190
.IP
186191
\f(CW$ sleepgraph -summary ~/workspace/myresults/\fR
187192
.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
192193

193-
.SS "Capturing Simple Timelines"
194+
.SS "capturing basic timelines"
194195
Execute a mem suspend with a 15 second wakeup. Include the logs in the html.
195196
.IP
196197
\f(CW$ sudo sleepgraph -rtcwake 15 -addlogs\fR
@@ -204,7 +205,7 @@ Execute a freeze with no wakeup (require keypress). Change output folder name.
204205
\f(CW$ sudo sleepgraph -m freeze -rtcwake off -o "freeze-{hostname}-{date}-{time}"\fR
205206
.PP
206207

207-
.SS "Capturing Advanced Timelines"
208+
.SS "capturing advanced timelines"
208209
Execute a suspend & include dev mode source calls, limit callbacks to 5ms or larger.
209210
.IP
210211
\f(CW$ sudo sleepgraph -m mem -rtcwake 15 -dev -mindev 5\fR
@@ -222,8 +223,7 @@ Execute a suspend using a custom command.
222223
\f(CW$ sudo sleepgraph -cmd "echo mem > /sys/power/state" -rtcwake 15\fR
223224
.PP
224225

225-
226-
.SS "Capturing Timelines with Callgraph Data"
226+
.SS "adding callgraph data"
227227
Add device callgraphs. Limit the trace depth and only show callgraphs 10ms or larger.
228228
.IP
229229
\f(CW$ sudo sleepgraph -m mem -rtcwake 15 -f -maxdepth 5 -mincg 10\fR
@@ -235,6 +235,16 @@ Capture a full callgraph across all suspend, then filter the html by a single ph
235235
\f(CW$ sleepgraph -dmesg host_mem_dmesg.txt -ftrace host_mem_ftrace.txt -f -cgphase resume
236236
.PP
237237

238+
.SS "rebuild timeline from logs"
239+
.PP
240+
Rebuild the html from a previous run's logs, using the same options.
241+
.IP
242+
\f(CW$ sleepgraph -dmesg dmesg.txt -ftrace ftrace.txt -callgraph\fR
243+
.PP
244+
Rebuild the html with different options.
245+
.IP
246+
\f(CW$ sleepgraph -dmesg dmesg.txt -ftrace ftrace.txt -addlogs -srgap\fR
247+
238248
.SH "SEE ALSO"
239249
dmesg(1)
240250
.PP

0 commit comments

Comments
 (0)