Commit graph

17 commits

Author SHA1 Message Date
Eric Biggers
d76e4e01c9 bootstat: remove unused FDE boot events
Android 13 dropped support for Full Disk Encryption (FDE) entirely, as
it has been replaced by File Based Encryption (FBE).  Therefore, the
FDE-specific boot events are never emitted.  Remove them from the code:

   * boot_decryption_complete
   * boot_complete_post_decrypt
   * factory_reset_boot_complete_post_decrypt
   * ota_boot_complete_post_decrypt
   * post_decrypt_time_elapsed

Bug: 208476087
Change-Id: Id7a3bbd4f273693bd37b0cd27542dc6080d1c4f4
2022-09-26 19:50:09 +00:00
Nikita Ioffe
4d8e3eaf9f Don't retrigger bootstat during userspace reboot.
Userspace reboot can be treated as extension of runtime restart: instead
of restarting just system_server, it restarts all post-data services.

Test: adb reboot userspace
Test: checked bootstat didn't run again.
Test: system/core/bootstat/boot_reason_test.sh
Bug: 135984674
Change-Id: Ieda4b201f9b9294a3a54b7f0118ee769f5dd2065
2020-02-03 10:30:06 +00:00
Wei Wang
4e9c653c93 bootstat: Update boot reason property earlier
bootstat updates boot reason upon boot_complete, however users of the
updated properties e.g. getLastShutdownReason from PowerManager could
be called before boot_complete. This introduces a inconsistency and
racing for those APIs.

In this CL, we change boot reason to be updated at the same time when
zygote starts where persist properties have been loaded already. Also
the initialization of bootloader's boot reason is pulled into post-fs
where all kernel command line arguments have been parsed in init already.

Bug: 122696730
Bug: 119509425
Test: trigger thermal shutdown and see warnings
Test: verify boot reason properties updated correctly post boot
Change-Id: Ia393b98ea072bc0ae6e4110d111393b34be0ee5d
Signed-off-by: Wei Wang <wvw@google.com>
2019-02-08 02:55:06 +00:00
Tej Singh
993f65619e Fix performance degradation from BootSequence atom
(partial cherry pick from commit fe3e762b6d)

Adding the boot sequence reported atom in ag/3518079 caused the duration
of bootstat to increase, as seen in b/72864061. I isolated the cause
down to calling BootReasonStrToReason. However, this function also gets
called in ReportBootReason, so I created another function that does the
parsing and sets the system boot reason property, and made
RecordBootReason and statsd logging get that property.

Bug: 72864061
Test: rebooted phone, verified boot events were received in adb shell
logcat -b stats and verified adb shell bootstat -p printed correct
values. Ran timing tests as well on walleye with 20 boots: before this
change, the average was ~150-160ms. After, it was ~80ms.
Change-Id: I92dbc9880328835647be7d9d50c7861b42f27bdb
Merged-In: I92dbc9880328835647be7d9d50c7861b42f27bdb
2018-06-04 13:31:05 -07:00
Mark Salyzyn
557a9d4054 bootstat: reduce overall boot time
Run bootstat as a oneshot service rather than as a series of inline
exec commands.  exec commands impact boot time.

Test: cts-tradefed run cts-dev --module CtsBootStatsTestCases
      system/core/bootstat/boot_reason_test.sh all
         (make sure it filters out new init reports)
Bug: 65736247
Change-Id: Ic9d509a8cbee4bc1e278081de1001e25ae0915fd
2017-09-19 07:36:34 -07:00
Mark Salyzyn
25246ddfe6 bootstat: bootloader stat files misspelled
Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: I6620c9965f4af8b6a3829f1f4cdcc9b691471a71
2017-09-19 14:34:42 +00:00
Mark Salyzyn
b304f6d4e7 bootstat: introduce sys.boot.reason
Adding functionality to bootstat --record_boot_complete and
--record_boot_reason to initialize sys.boot.reason, the canonical
system boot reason.

Filter out ro.boot.bootreason oem noise into sys.boot.reason.  Add
heuristics to determine what the boot reason is, when otherwise would
be defaulting to the blunt and relatively devoid of detail catch-all
reboot reasons ("reboot", "shutdown", "cold", "warm", "hard").

boot_reason_test.sh is also a compliance test.

Test: boot_reason_test.sh all
Bug: 63736262
Change-Id: Ic9a42cccbcfc89a5c0e081ba66d577a97c8c8c76
2017-09-12 09:28:25 -07:00
Mark Salyzyn
c3ad75be84 bootstat: switch from root.root to system.log
bootstat does not need root uid and root gid permissions to perform
its tasks.  It appears that system uid and log gid are adequate and
appropriate.

Test: manual
Bug: 63736262
Change-Id: I094c2cb054e441562fa8717a4d3dc0086fb70a7a
2017-08-09 15:08:21 -07:00
Wei Wang
bd6ab49555 bootstat.rc: record post_decrypt_time_elapsed only for FDE device
Bug: 35110957
Test: on marlin
Change-Id: Id32f65ad4d693dcf52f1581bf55b3fe671c985cc
2017-02-09 10:09:22 -08:00
James Hawkins
f1c2350668 bootstat: Update the wording of 'soft reboot' to 'runtime restart'.
In an effort to be more accurate with respect to terminology.

Bug: None
Test: None
Change-Id: Ida8e118975e715c686aa7fd526f964e78c06aa06
2017-02-01 01:30:08 +00:00
James Hawkins
800ceb45b1 bootstat: Fix false metrics due to soft reboots.
Use a flag to enable/disable logging metrics, set to false during soft
reboots.

Bug: 32807863
Change-Id: Ib1359327af4e18d40400c29961c454f7be1b8d0c
Test: None
2017-01-17 13:28:17 -08:00
James Hawkins
e4079fbdef bootstat: Fix the boot complete signal for FBE devices.
FBE devices suffice with bootanim=stopped, but must be gated on
ro.crypto.type=file.

Bug: 33049941
Test: adb reboot && adb logcat | grep bootstat < Has output
Change-Id: I346d47aaf9d1d4b40f05906056849630b922a20d
2016-12-01 14:02:17 -08:00
James Hawkins
c08e996ac8 bootstat: Disambiguate boot time on encrypted devices.
This change introduces new metrics to discern boot time on encrypted devices:
* post_decrypt_time_elapsed
* boot_decryption_complete
* boot_complete_post_decrypt
* boot_complete_no_encryption

Bug: 27497357
Change-Id: I8d3a411029bd6a45f80589ff67c408593e133a87
2016-03-11 15:50:39 -08:00
James Hawkins
5e655f02c5 bootstat: Gate boot time metrics logging on an encrypted device being decrypted.
This prevents double-counting boot metrics for encrypted devices.

Bug: 27454346
Change-Id: If63dd421e4f91a01b43d730d59896544a26d138a
2016-03-03 14:40:29 -08:00
James Hawkins
53684ea625 bootstat: Record the time since factory reset on init.
Bug: 25448351
Change-Id: I71905a598e74f41c18a96d469c7a6ddd5a2e07fb
2016-02-24 11:01:03 -08:00
James Hawkins
a4a1a4ac85 bootstat: Add support for logging the boot_reason metric.
This value is read from the ro.boot.bootreason system property.

Bug: 21724738
Change-Id: I43bef3d85ba9c8d87669a91da1aa675d9a86e348
2016-02-09 15:32:38 -08:00
James Hawkins
6bff639c19 bootstat: Hook up bootstat to record the boot complete signal and log
boot events in the LOCAL_INIT_RC file, bootstat.rc.

This change also creates the /data/misc/bootstat dir during the
filesystem creation block in init.rc.

Bug: 21724738
Change-Id: I2ad6913c0235d5f926c6ef8b3c65d650159c6ed7
2016-01-26 11:23:31 -08:00