xref: /aosp_15_r20/system/core/bootstat/README.md (revision 00c7fec1bb09f3284aad6a6f96d2f63dfc3650ad)
1*00c7fec1SAndroid Build Coastguard Worker# bootstat #
2*00c7fec1SAndroid Build Coastguard Worker
3*00c7fec1SAndroid Build Coastguard WorkerThe bootstat command records boot events (e.g., `firmware_loaded`,
4*00c7fec1SAndroid Build Coastguard Worker`boot_complete`) and the relative time at which these events occurred. The
5*00c7fec1SAndroid Build Coastguard Workercommand also aggregates boot event metrics locally and logs the metrics for
6*00c7fec1SAndroid Build Coastguard Workeranalysis.
7*00c7fec1SAndroid Build Coastguard Worker
8*00c7fec1SAndroid Build Coastguard Worker    Usage: bootstat [options]
9*00c7fec1SAndroid Build Coastguard Worker    options include:
10*00c7fec1SAndroid Build Coastguard Worker      -h, --help            Show this help
11*00c7fec1SAndroid Build Coastguard Worker      -l, --log             Log all metrics to logstorage
12*00c7fec1SAndroid Build Coastguard Worker      -p, --print           Dump the boot event records to the console
13*00c7fec1SAndroid Build Coastguard Worker      -r, --record          Record the timestamp of a named boot event
14*00c7fec1SAndroid Build Coastguard Worker      --record_boot_reason  Record the reason why the device booted
15*00c7fec1SAndroid Build Coastguard Worker      --record_time_since_factory_reset Record the time since the device was reset
16*00c7fec1SAndroid Build Coastguard Worker
17*00c7fec1SAndroid Build Coastguard Worker## Relative time ##
18*00c7fec1SAndroid Build Coastguard Worker
19*00c7fec1SAndroid Build Coastguard WorkerThe timestamp recorded by bootstat is the uptime of the system, i.e., the
20*00c7fec1SAndroid Build Coastguard Workernumber of seconds since the system booted.
21*00c7fec1SAndroid Build Coastguard Worker
22*00c7fec1SAndroid Build Coastguard Worker## Recording boot events ##
23*00c7fec1SAndroid Build Coastguard Worker
24*00c7fec1SAndroid Build Coastguard WorkerTo record the relative time of an event during the boot phase, call `bootstat`
25*00c7fec1SAndroid Build Coastguard Workerwith the `-r` option and the name of the boot event.
26*00c7fec1SAndroid Build Coastguard Worker
27*00c7fec1SAndroid Build Coastguard Worker    $ bootstat -r boot_complete
28*00c7fec1SAndroid Build Coastguard Worker
29*00c7fec1SAndroid Build Coastguard WorkerThe relative time at which the command runs is recorded along with the name of
30*00c7fec1SAndroid Build Coastguard Workerthe boot event to be persisted.
31*00c7fec1SAndroid Build Coastguard Worker
32*00c7fec1SAndroid Build Coastguard Worker## Logging boot events ##
33*00c7fec1SAndroid Build Coastguard Worker
34*00c7fec1SAndroid Build Coastguard WorkerTo log the persisted boot events, call `bootstat` with the `-l` option.
35*00c7fec1SAndroid Build Coastguard Worker
36*00c7fec1SAndroid Build Coastguard Worker    $ bootstat -l
37*00c7fec1SAndroid Build Coastguard Worker
38*00c7fec1SAndroid Build Coastguard Workerbootstat logs all boot events recorded using the `-r` option to the EventLog
39*00c7fec1SAndroid Build Coastguard Workerusing the Tron histogram. These logs may be uploaded by interested parties
40*00c7fec1SAndroid Build Coastguard Workerfor aggregation and analysis of boot time across different devices and
41*00c7fec1SAndroid Build Coastguard Workerversions.
42*00c7fec1SAndroid Build Coastguard Worker
43*00c7fec1SAndroid Build Coastguard Worker## Printing boot events ##
44*00c7fec1SAndroid Build Coastguard Worker
45*00c7fec1SAndroid Build Coastguard WorkerTo print the set of persisted boot events, call `bootstat` with the `-p` option.
46*00c7fec1SAndroid Build Coastguard Worker
47*00c7fec1SAndroid Build Coastguard Worker    $ bootstat -p
48*00c7fec1SAndroid Build Coastguard Worker    Boot events:
49*00c7fec1SAndroid Build Coastguard Worker    ------------
50*00c7fec1SAndroid Build Coastguard Worker    boot_complete   71