800ceb45b1
Use a flag to enable/disable logging metrics, set to false during soft reboots. Bug: 32807863 Change-Id: Ib1359327af4e18d40400c29961c454f7be1b8d0c Test: None
44 lines
1.8 KiB
Text
44 lines
1.8 KiB
Text
# This file is the LOCAL_INIT_RC file for the bootstat command.
|
|
|
|
on post-fs-data
|
|
mkdir /data/misc/bootstat 0700 root root
|
|
|
|
# Record the time at which the user has successfully entered the pin to decrypt
|
|
# the device, /data is decrypted, and the system is entering the main boot phase.
|
|
#
|
|
# post-fs-data: /data is writable
|
|
# property:init.svc.bootanim=running: The boot animation is running
|
|
on post-fs-data && property:init.svc.bootanim=running
|
|
exec - root root -- /system/bin/bootstat -r post_decrypt_time_elapsed
|
|
|
|
# sys.logbootcomplete is a signal to enable the bootstat logging mechanism.
|
|
# This signaling is necessary to prevent logging boot metrics after a soft
|
|
# reboot (e.g., adb shell stop && adb shell start). /proc/uptime is not reset
|
|
# during a soft reboot, which leads to false boot time metrics being reported.
|
|
#
|
|
# The 'on boot' event occurs once per hard boot (device power on), which
|
|
# switches the flag on. If the device performs a soft reboot, the flag is
|
|
# switched off and cannot be switched on until the device hard boots again.
|
|
|
|
# Enable bootstat logging on boot.
|
|
on boot
|
|
setprop sys.logbootcomplete 1
|
|
|
|
# Disable further bootstat logging on a soft reboot. A soft reboot is
|
|
# signaled by the zygote stopping.
|
|
on property:init.svc.zygote=stopping
|
|
setprop sys.logbootcomplete 0
|
|
|
|
# Record boot complete metrics.
|
|
on property:sys.boot_completed=1 && property:sys.logbootcomplete=1
|
|
# Record boot_complete and related stats (decryption, etc).
|
|
exec - root root -- /system/bin/bootstat --record_boot_complete
|
|
|
|
# Record the boot reason.
|
|
exec - root root -- /system/bin/bootstat --record_boot_reason
|
|
|
|
# Record time since factory reset.
|
|
exec - root root -- /system/bin/bootstat --record_time_since_factory_reset
|
|
|
|
# Log all boot events.
|
|
exec - root root -- /system/bin/bootstat -l
|