From c0188da289969db7e814bacdac83e37afa6849c3 Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Tue, 23 Feb 2016 16:18:19 -0800 Subject: [PATCH] bootstat: Record the time since factory reset on init. Bug: 25448351 Change-Id: I71905a598e74f41c18a96d469c7a6ddd5a2e07fb (cherry picked from commit 53684ea625b9cff34f9cdb2d4bae4cd25538ca3b) --- bootstat/README.md | 1 + bootstat/bootstat.cpp | 5 +++-- bootstat/bootstat.rc | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bootstat/README.md b/bootstat/README.md index b3964ce1c..76ea6c1e3 100644 --- a/bootstat/README.md +++ b/bootstat/README.md @@ -12,6 +12,7 @@ analysis. -p, --print Dump the boot event records to the console -r, --record Record the timestamp of a named boot event --record_boot_reason Record the reason why the device booted + --record_time_since_factory_reset Record the time since the device was reset ## Relative time ## diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp index 0c49f8217..c199190eb 100644 --- a/bootstat/bootstat.cpp +++ b/bootstat/bootstat.cpp @@ -80,7 +80,8 @@ void ShowHelp(const char *cmd) { " -l, --log Log all metrics to logstorage\n" " -p, --print Dump the boot event records to the console\n" " -r, --record Record the timestamp of a named boot event\n" - " --record_boot_reason Record the reason why the device booted\n"); + " --record_boot_reason Record the reason why the device booted\n" + " --record_time_since_factory_reset Record the time since the device was reset\n"); } // Constructs a readable, printable string from the givencommand line @@ -192,7 +193,7 @@ int main(int argc, char **argv) { int option_index = 0; static const char boot_reason_str[] = "record_boot_reason"; - static const char factory_reset_str[] = "record_factory_reset"; + static const char factory_reset_str[] = "record_time_since_factory_reset"; static const struct option long_options[] = { { "help", no_argument, NULL, 'h' }, { "log", no_argument, NULL, 'l' }, diff --git a/bootstat/bootstat.rc b/bootstat/bootstat.rc index 218b9f8bb..13ef27ea0 100644 --- a/bootstat/bootstat.rc +++ b/bootstat/bootstat.rc @@ -13,5 +13,8 @@ on property:init.svc.bootanim=stopped # 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