^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) .TH BOOTGRAPH 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) .SH NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) bootgraph \- Kernel boot timing analysis
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) .SH SYNOPSIS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) .ft B
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) .B bootgraph
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) .RB [ OPTIONS ]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) .RB [ COMMAND ]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) .SH DESCRIPTION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) \fBbootgraph \fP reads the dmesg log from kernel boot and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) creates an html representation of the initcall timeline. It graphs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) every module init call found, through both kernel and user modes. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) timeline is split into two phases: kernel mode & user mode. kernel mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) represents a single process run on a single cpu with serial init calls.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) Once user mode begins, the init process is called, and the init calls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) start working in parallel.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) .PP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) If no specific command is given, the tool reads the current dmesg log and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) outputs a new timeline.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) .PP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) The tool can also augment the timeline with ftrace data on custom target
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) functions as well as full trace callgraphs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) .PP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) Generates output files in subdirectory: boot-yymmdd-HHMMSS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) html timeline : <hostname>_boot.html
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) raw dmesg file : <hostname>_boot_dmesg.txt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) raw ftrace file : <hostname>_boot_ftrace.txt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) .SH OPTIONS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) .TP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) \fB-h\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) Print this help text
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) .TP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) \fB-v\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) Print the current tool version
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) .TP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) \fB-addlogs\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) Add the dmesg log to the html output. It will be viewable by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) clicking a button in the timeline.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) .TP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) \fB-result \fIfile\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) Export a results table to a text file for parsing.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) .TP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) \fB-o \fIname\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) Overrides the output subdirectory name when running a new test.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) Use {date}, {time}, {hostname} for current values.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) .sp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) e.g. boot-{hostname}-{date}-{time}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) .SS "advanced"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) .TP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) \fB-f or -callgraph\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) Use ftrace to create initcall callgraphs (default: disabled). If -func
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) is not used there will be one callgraph per initcall. This can produce
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) very large outputs, i.e. 10MB - 100MB.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) .TP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) \fB-fstat\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) Use ftrace to add function detail (default: disabled)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) .TP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) \fB-maxdepth \fIlevel\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) limit the callgraph trace depth to \fIlevel\fR (default: 2). This is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) the best way to limit the output size when using -callgraph.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) .TP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) \fB-mincg \fIt\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) Discard all callgraphs shorter than \fIt\fR milliseconds (default: 0=all).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) This reduces the html file size as there can be many tiny callgraphs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) which are barely visible in the timeline.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) The value is a float: e.g. 0.001 represents 1 us.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) .TP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) \fB-cgfilter \fI"func1,func2,..."\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) Reduce callgraph output in the timeline by limiting it to a list of calls. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) argument can be a single function name or a comma delimited list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) (default: none)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) .TP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) \fB-cgskip \fIfile\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) Reduce callgraph output in the timeline by skipping over uninteresting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) functions in the trace, e.g. printk or console_unlock. The functions listed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) in this file will show up as empty leaves in the callgraph with only the start/end
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) times displayed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) (default: none)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) .TP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) \fB-timeprec \fIn\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) Number of significant digits in timestamps (0:S, 3:ms, [6:us])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) .TP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) \fB-expandcg\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) pre-expand the callgraph data in the html output (default: disabled)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) .TP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) \fB-func \fI"func1,func2,..."\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) Instead of tracing each initcall, trace a custom list of functions (default: do_one_initcall)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) .TP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) \fB-reboot\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) Reboot the machine and generate a new timeline automatically. Works in 4 steps.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) 1. updates grub with the required kernel parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) 2. installs a cron job which re-runs the tool after reboot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) 3. reboots the system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) 4. after startup, extracts the data and generates the timeline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) .TP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) \fB-manual\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) Show the requirements to generate a new timeline manually. Requires 3 steps.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) 1. append the string to the kernel command line via your native boot manager.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) 2. reboot the system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 3. after startup, re-run the tool with the same arguments and no command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) .SH COMMANDS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) .SS "rebuild"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) .TP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) \fB-dmesg \fIfile\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) Create HTML output from an existing dmesg file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) .TP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) \fB-ftrace \fIfile\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) Create HTML output from an existing ftrace file (used with -dmesg).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) .SS "other"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) .TP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) \fB-flistall\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) Print all ftrace functions capable of being captured. These are all the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) possible values you can add to trace via the -func argument.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) .TP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) \fB-sysinfo\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) Print out system info extracted from BIOS. Reads /dev/mem directly instead of going through dmidecode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) .SH EXAMPLES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) Create a timeline using the current dmesg log.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) .IP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) \f(CW$ bootgraph\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) .PP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) Create a timeline using the current dmesg and ftrace log.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) .IP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) \f(CW$ bootgraph -callgraph\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) .PP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) Create a timeline using the current dmesg, add the log to the html and change the folder.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) .IP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) \f(CW$ bootgraph -addlogs -o "myboot-{date}-{time}"\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) .PP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) Capture a new boot timeline by automatically rebooting the machine.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) .IP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) \f(CW$ sudo bootgraph -reboot -addlogs -o "latest-{hostname)"\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) .PP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) Capture a new boot timeline with function trace data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) .IP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) \f(CW$ sudo bootgraph -reboot -f\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) .PP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) Capture a new boot timeline with trace & callgraph data. Skip callgraphs smaller than 5ms.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) .IP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) \f(CW$ sudo bootgraph -reboot -callgraph -mincg 5\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) .PP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) Capture a new boot timeline with callgraph data over custom functions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) .IP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) \f(CW$ sudo bootgraph -reboot -callgraph -func "acpi_ps_parse_aml,msleep"\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) .PP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) Capture a brand new boot timeline with manual reboot.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) .IP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) \f(CW$ sudo bootgraph -callgraph -manual\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) .IP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) \f(CW$ vi /etc/default/grub # add the CMDLINE string to your kernel params\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) .IP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) \f(CW$ sudo reboot # reboot the machine\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) .IP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) \f(CW$ sudo bootgraph -callgraph # re-run the tool after restart\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) .PP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) .SS "rebuild timeline from logs"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) .PP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) Rebuild the html from a previous run's logs, using the same options.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) .IP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) \f(CW$ bootgraph -dmesg dmesg.txt -ftrace ftrace.txt -callgraph\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) .PP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) Rebuild the html with different options.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) .IP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) \f(CW$ bootgraph -dmesg dmesg.txt -ftrace ftrace.txt -addlogs\fR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) .SH "SEE ALSO"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) dmesg(1), update-grub(8), crontab(1), reboot(8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) .PP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) .SH AUTHOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) .nf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) Written by Todd Brandt <todd.e.brandt@linux.intel.com>