Commit graph

200 commits

Author SHA1 Message Date
James Hawkins
b623389421 Merge "bootstat: Add a few more bootreasons." 2017-11-29 19:29:54 +00:00
James Hawkins
74b1758cad bootstat: Add a few more bootreasons.
Bug: none
Test: none
Change-Id: I9b482e642a9eec26670118a265046194f3cc2a7a
2017-11-28 15:20:44 -08:00
Mark Salyzyn
547063eab6 bootstat: kernel_panic test w/o bootloader or pstore support
If the platform has no bootloader or pstore support, kernel_panic
test should fail if the results are not correct. Drop skipping of
failed test if pstore support is lacking.

If device demonstrably has pstore content support, the result must
be exacting kernel_panic,sysrq. Otherwise accept the less precise
result.

Test: On hikey960 (which currently lacks reliable pstore, or a
      compliant bootloader reporting bootreason), expect failure of:
      system/core/bootstat/boot_reason_test.sh kernel_panic
Bug: 63736262
Change-Id: I071a2a9c00dc522ec037c8a8997fea524d17e6e4
2017-11-20 12:18:09 -08:00
James Hawkins
8ac79bc820 bootstat: Add another boot reason.
Bug: None
Test: None
Change-Id: I865a12e9c8833c4a345284181aa1812be3eddadd
2017-10-31 10:07:34 -07:00
Mark Salyzyn
e7c95fb34f bootstat: test: add error propagation for fastboot format userdata
Test: system/core/bootstat/boot_reason_test.sh optional_factory_reset
Bug: 63736262
Change-Id: I8893df15ef802bb76c0795288df91d8463bfe3d1
2017-10-27 08:32:55 -07:00
Mark Salyzyn
293cb3b217 bootstat: handle a bad bit error rate issue with pstore
Create a private rfind that allows a fuzzy match based on a bit error
rate (BER) of 1 every 8 bits.  last kmsg is affected by pstore ramoops
backing that suffers from data corruption.  Add some additional
validation based on possible data corruption scenarios, as a noisy
match means higher chance of noisy data.

Noisy data notably can affect the battery level detection, but do not
typically result in false positives.  Battery level, or failure, is
the responsibility of the BatteryStats service, providing a positive
signal and strong device-independent algorithm.  The checking done in
bootstat is likely to be deprecated in favour of an API request to
BatteryStats once their algorithms deal with surprise outages due to
aging.

The kernel logging heuristic and BER fixup handily deals with a
prevalent issue where some bootloaders failure to properly notify us
of panics.  This is where the gains are noticed with this improvement.

Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: I93b4210f12fb47c5c036f4d6eb4cafeee4896d35
2017-10-26 14:17:14 -07:00
Mark Salyzyn
747c0e6216 bootstat: better validation of battery level (shutdown,battery)
Replace simple strtoull with loop that ensures no leading zeros.
Restrict size of value buffer being checked as allocation was
going to end of retrieved buffer, which can cause unnecessary
memory pressure during boot.

Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: Ifdc1d4fd3a73794c001577024ce7cbfde9c25028
2017-10-26 14:17:14 -07:00
Mark Salyzyn
dafced93a5 bootstat: Do not allow unknown boot reasons to land in first field.
If we sniff an unknown boot reason from last kmsg, make sure it
has a "reboot," prefix.

Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: Ia1c401b8899d1f0c56bd4f5d8d2d19b7fc889a30
2017-10-26 14:14:40 -07:00
Mark Salyzyn
88d692c09e bootstat: move boot reason validation transformation policy into subroutine.
Allow for future policy adjustments.

SideEffects: None
Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: I571fb7dafc6b80c75d2809a3da3f9b96784cef06
2017-10-26 14:11:04 -07:00
Mark Salyzyn
72a8ea3d3c bootstat: test: fix Its_Just_So_Hard_reboot
Add the test injection to known list, and deal with an error
propagation issue.

Test: system/core/bootstat/boot_reason_test.sh Its_Just_So_Hard_reboot
Bug: 63736262
Change-Id: I4799956978a8884c69c830fcedd7febd143651fd
2017-10-26 14:10:31 -07:00
Mark Salyzyn
c89f9da060 bootstat: add shutdown,thermal,battery
Test: system/core/bootreason/boot_reason_test.sh
Bug: 63736262
Change-Id: I30d6b5308fd8616eae31ad13e925d66c9fc07367
2017-10-25 15:45:49 -07:00
Mark Salyzyn
cabbe4ff35 bootstat: add reboot,2sec
Test: system/core/bootreason/boot_reason_test.sh
Bug: 63736262
Change-Id: Ie2e5872adb14e0979ff87eb4d2f57ab2849facd4
2017-10-25 15:45:49 -07:00
Mark Salyzyn
2a8e5cce33 bootstat: test: check ro.boot.bootreason in some tests
blind_reboot_test() did not report the ro.boot.bootreason value,
making it more difficult to diagnose failures.

Test: system/core/bootstat/boot_reason_test.sh cold warm hard
Bug: 63736262
Change-Id: I313cfef202b1e06c583b0b47cd5d0e0888a7dbe7
2017-10-25 15:45:49 -07:00
Mark Salyzyn
73691aafc2 bootstat: fix test regression (exec_background)
Deal with regression from 557a9d4054
where bootstat was moved to exec_background and actions delayed
to improve boot time.  Add a 1 second sleep rather than trying to
inspect the dmesg (debug only) for clues to the end of bootstat.

Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: I87dfb6a07130112bf51c367632967efa53ea2534
2017-10-25 15:45:46 -07:00
Mark Salyzyn
bcf66ed699 bootstat: fix test regression (extra logging)
Deal with regression from 9a3870490a
where additional content is logged and should be ignored.

Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: I70709ba5b00ea18a653ff8d1658556b7d4c48775
2017-10-25 15:40:56 -07:00
Treehugger Robot
a03c935e27 Merge "bootstat: Add more boot reasons found by logging in the wild." 2017-10-19 19:41:34 +00:00
James Hawkins
34073b583a bootstat: Add more boot reasons found by logging in the wild.
Bug: none
Test: none
Change-Id: I7e388326be44aeb3e6fdb79d2e173dc17eb8bc1f
2017-10-19 10:44:22 -07:00
Josh Gao
52315ae329 bootstat: remove extraneous android_logcat_destroy.
android_logcat_pclose already does that.

Bug: http://b/67960705
Test: mma
Change-Id: I03d06b10807e8a313c9654c2e1db36bfb59e3f99
2017-10-18 16:57:33 -07:00
Mark Salyzyn
244947e813 bootstat: test: duration fixes
misspelled duration_test in test_thermal_shutdown

Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: I5981fa899db84199aefb46c8741511e6889bc79c
2017-10-13 09:29:53 -07:00
Mark Salyzyn
9a3870490a bootstat: test: inject ro.boot.bootreason values
Adding a set of automated engineering unit tests with a strict list of
prerequisites.  Not meant for "user" builds.  Must have a crafted
bootloader that does not set the boot reason.  Only works on platforms
where the bootloader either by accident or specifically does not set
the ro.boot.bootreason via kernel command line configuration
androidboot.bootreason=.  If the tests do not have the prerequisites,
the test will report success, but with protest.

These new tests should work on current Hikey and Hikey960 bootloaders
but could very well become obsolete if those platform bootloaders
start setting the boot reason.

We do not want a platform solution as it could allow a third party to
override the bootloader boot reason.

Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: I1793184a8484b83e1d9077475bc65af9816dadf7
2017-10-11 13:48:33 -07:00
Mark Salyzyn
bb52cbf35d Merge "bootstat: test: refine reported test durations" 2017-10-11 20:33:05 +00:00
Mark Salyzyn
444e3a9f74 Merge "bootstat: Add some reserved sys.boot.reason values to enumeration" 2017-10-11 20:32:00 +00:00
Mark Salyzyn
2450cb1a30 bootstat: test: refine reported test durations
Use actual test durations to refine future duration estimates.
Better estimates are cosmetic, but lend confidence to the test
results.

SideEffects: none
Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: I49143b78a6dc6fb21838a3d6c70b7eb5a8b4cba5
2017-10-11 10:56:54 -07:00
Mark Salyzyn
243fa29804 bootstat: Add some reserved sys.boot.reason values to enumeration
Add cold,powerkey, warm,s3_wakeup and hard,hw_reset so that
sys.boot.reason values can also be enumerated.  Also add
some reserved speculative entries associated with forced
suspend to RAM and DISK; shutdown,suspend and shutdown,hibernate
respectively.

Test: system/core/bootstat/boot_reason_test.sh
Bug: 67636061
Change-Id: Ic43523748e6006aaca882f8eec7c1f0c08431bd8
2017-10-11 10:56:42 -07:00
James Hawkins
25f7122512 bootstat: Special case logging for empty boot reason.
Empty boot reason is mostly unexpected but may take up the bulk of
unknown reported boot reason values.

Bug: none
Test: none
Change-Id: I9978658c2b052d5cf5d28299861b0d1125ba9fc0
2017-10-10 16:37:05 -07:00
Mark Salyzyn
6290982ee3 init+bootstat: reduce last reboot reason to canonical alias
To make parsing easier for last reboot reason.  This also ensures that
last boot reason matches the content that is typically returned by the
bootloader or in turn landed in the canonical system boot reason.

Simplify parsing in bootstat.  Adjust and fix boot_reason_test.sh for
new reality.  Allow boot reason tests battery and kernel_panic to pass
if device does not support pstore (empty before and after the test).
If device somehow landed in fastboot mode while waiting for the
display, issue a fastboot reboot to move the test along.  Some cleanup
and standardization changes to the test script.

Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: I97d5467c0b4a6d65df3525f1a2d0051db813d5ad
2017-10-10 09:37:59 -07:00
Mark Salyzyn
0af71a5327 bootstat: system_boot_reason does not handle reboot_<reason> case
Heuristic would translate reboot_<reason> to reboot._<reason>. Add
checking/squashing for leading comma (,) _or_ underscore (_).

Test: compile
Bug: 63736262
Change-Id: I7ef4930ec8c064a8151183ac08d292931a8584c8
2017-10-05 14:42:08 -07:00
Mark Salyzyn
161b8626bd init: report shutdown,container for sigterm of init
Change HandleSigtermSignal() handler to report shutdown,container. Add
the new reason to bootstat.  Remove log stutter as
HandlPowerctlMessage will also do a LOG(INFO) reporting
shutdown,container as reason.

Sending SIGTERM to init is to allow a host OS to ask an Android
Container instance to shutdown.  The temptation is to report
shutdown,sigterm but that does not accurately describe the usage
scenario.

Test: compile
Bug: 63736262
Change-Id: I3c5798921bdbef5d2689ad22a2e8103741b570b4
2017-09-27 09:10:00 -07:00
Mark Salyzyn
9033bf5a2e bootstat: Add reboot,userrequested
Result of holding power button down and hitting restart.

Test: compile
Bug: 63736262
Change-Id: I271bdf135cece5fd9dc9e60ddf8add595ed3da4c
2017-09-21 11:30:29 -07:00
Mark Salyzyn
a16e437e9d bootstat: validate last kmsg and bootreason content more carefully
Establish a tighter trust relationship with digitization of the
battery level.  Validate the reboot reason collected from the last
kmsg.  Validate the last reboot reason before using for enhancing
system reboot reason.

Test: system/core/bootstat/boot_reason_test.sh
Bug: 63636262
Change-Id: I45fbac4a33c09295cda89de3b73c93a884033e3b
2017-09-20 11:28:02 -07:00
Mark Salyzyn
14b1e6d63d bootstat: clang-format rebase
Code style has drifted too far from our current clang-format
settings.

Test: compile
Side-Effects: none
Bug: 63736262
Change-Id: Ie390459db123cfadf09aa06c8dafb1ae69a72af8
2017-09-20 11:27:56 -07:00
Mark Salyzyn
6461089bf8 bootstat: refine kernel panic details
If bootloader reports kernel_panic, gives us permission for a
deeper check of which kind occurred.  Resolve a problem with
some kernels that do not have the 'sysrq: SysRq :' log stutter.

Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: Idb8978de7a4f4e3c671c6ab7efc5ebe841f7bbd8
2017-09-19 16:30: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
8a30fcabcb bootstat: battery test fails on QC devices
Send the message multiple times into the last dmesg log so that one
may be picked up without data corruption.

Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: Ie42ad1940b1eb4915e4cf6cc61815d0275a70ffe
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
08b0256ea1 bootstat: reboot cold, warm and hard tests failed
If the bootloader insists on reporting reboot for cold, warm and
hard, we need to reconstruct canonical reason from the
persist.sys.boot.reason property.

Some log lines contained bootstate, letting their noise through
during testing, changed regex to look for bootstat[^e].

Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: I3788c6cf8aca7fc73dd01bf95acb596d18ed7ee4
2017-09-18 21:03:10 +00:00
James Hawkins
5240f204ed bootstat: Log the ro.boot.bootreason property through the new platform_reason Tron field.
Bug: 63584589
Test: none
Change-Id: Ifd6f3d4432d764b5ffc7db10dec5e573214f7c97
2017-09-15 16:01:57 -07:00
Mark Salyzyn
277eca138b adb: reboot: last boot command default
For reboot [reboot_arg] requests via either reboot or adb reboot,
if reboot_arg is empty then report "shell" or "adb" respectively.

Test: boot_reason_test.sh shell_reboot adb_reboot
Bug: 63736262
Change-Id: Ie613d9e62db6a705885e4e7520aede27af3aa1b9
2017-09-12 12:24:02 -07: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
Treehugger Robot
29b9411685 Merge "bootstat: Log even more boot reasons." 2017-07-26 19:27:03 +00:00
James Hawkins
8d7f63da26 bootstat: Log even more boot reasons.
Bug: 27555866
Test: None
Change-Id: I8ab6597a323f5973d8b1c22c2c7422ef0c2efcc3
2017-07-25 15:58:48 -07:00
Lennart Wieboldt
cd15fc7ba8 Remove LOCAL_CLANG and clang: true
clang is the default compiler since Android nougat

Test: mma & verified it´s still build with clang
Change-Id: I34adaeef2f6558a09f26027271222bad94780507
Signed-off-by: Lennart Wieboldt <lennart.1997@gmx.de>
2017-07-25 14:29:50 +02:00
Yongqin Liu
78b2b94d1d bootstat.cpp: update help message for --record_boot_complete
add description about --record_boot_complete in the help

Test: manually with HiKey

Change-Id: I521d6f5b9d98113c006fc6ab146b6c353ce2390c
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2017-07-07 15:27:10 +00:00
James Hawkins
0bc4ad479a bootstat: Log factory_reset_boot_complete separately from ota_*.
Bug: 37164359
Test: none
Change-Id: I7ed68e299846050fdffa58db8d2bd35fe4599dbb
2017-05-30 15:03:15 -07:00
James Hawkins
259dc730da bootstat: Set up clang-format-2 for bootstat.
Bug: None
Test: None
Change-Id: I534801dae4baec52687c8bbc563f8d92fca1a106
2017-05-24 10:19:25 -07:00
James Hawkins
1bfcaec1ab bootstat: Calculate and log the absolute device boot time.
Bug: 38345538
Test: None
Change-Id: I76a4b831cc3809d37b7edfcf1b5657cdf363832a
2017-05-23 14:43:49 -07:00
Dan Shi
0f0cccc102 Add test config to bootstat_tests
This change allows TradeFederation to run the test directly.
Refer to b/35882476 for design and discussion of this change.

Bug: 35882476
Test: local test
tradefed.sh run template/local --template:map test=bootstat_tests

Change-Id: I3bc2fa19faebe21f6faf8b81e206ea1581918344
2017-04-05 14:49:47 +00:00
James Hawkins
e78ea77f69 bootstat: Refactor init/utils/boot_clock into base/chrono_utils.
Use this for bootstat and init. This replaces the custom uptime parser in
bootstat.

This is a reland of aosp/338325 with a stubbed implementation for Darwin.

This change also has clang_format fixes (automatic).

Bug: 34352037
Test: chrono_utils_test
Change-Id: I72a62a3ca1ccfc0a4ccc6294ff1776c263144686
2017-03-30 14:24:12 -07:00
James Hawkins
6b5c5aa067 bootstat: Report the total bootloader time.
Bug: 35207415
Test: none
Change-Id: Id948a3b35bb3d96dc875d0a4eea869c86a71a657
2017-02-16 11:53:03 -08:00
James Hawkins
c8ac067773 Revert "bootstat: Refactor init/utils/boot_clock into base/chrono_utils."
This reverts commit 7c92e48450.

Mac sdk still broken (despite testing locally).

Change-Id: I7d9206e15997cd0efe081bd3fa17d53d2b20ec32
2017-02-14 19:20:20 +00:00
James Hawkins
7c92e48450 bootstat: Refactor init/utils/boot_clock into base/chrono_utils.
Use this for bootstat and init. This replaces the custom uptime parser in
bootstat.

This is a reland of aosp/332854 with a fix for Darwin.

Bug: 34352037
Test: chrono_utils_test
Change-Id: Ib2567d8df0e460ab59753ac1c053dd7f9f1008a7
2017-02-13 15:47:21 -08:00
James Hawkins
64984aaa6e Merge "libmetricslogger: Refactor Tron metrics histogram logging out of bootstat." 2017-02-13 18:41:23 +00: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
0e3167e203 Revert "bootstat: Remove custom uptime parser in favor of elapsedRealtime."
This reverts commit 26f40c04c3.

This change broke the Darwin SDK target.

Test: none
Change-Id: Ia54fe2c31da8d8fa2825e023b035fb8321dcd457
2017-02-08 14:16:51 -08:00
James Hawkins
26f40c04c3 bootstat: Remove custom uptime parser in favor of elapsedRealtime.
Refactored init/utils/boot_clock into base/chrono_utils.

Bug: 34352037
Test: none
Change-Id: Ied0c00867336b85922369d7ff37520e3d28fc61e
2017-02-07 15:43:32 -08:00
James Hawkins
be46fd1b94 bootstat: Log bootloader timing metrics to Tron.
Bug: 34944249
Test: None
Change-Id: Ica6d87c8631a6cc8d70a01186686381f9dc352f9
2017-02-02 16:28:25 -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
9aec926f86 libmetricslogger: Refactor Tron metrics histogram logging out of
bootstat.

To be shared with other native components that want to log histograms.

Bug: 34456830
Test: libmetricslogger_test
Change-Id: I94a1a91c6d33e443d66bc480158dc2470d6c9031
2017-01-31 11:42:24 -08:00
James Hawkins
27c052263c boottime/init: Report ro.boottime.init* properties in milliseconds.
* Nanosecond precision ended up being harder to grok.
* This change modifies the Timer class to have duration_ms instead of
duration_ns.

Bug: 34466121
Test: adb logcat | grep bootstat
Change-Id: Ibd1c27dc3cb29d838a956e342281b2fb98d752a6
2017-01-27 08:26:14 -08:00
James Hawkins
a51b165c7a bootstat: Remove debug logging of bootstat_mtime_matches_content.
Bug: 34507152
Test: bootstat_tests
Change-Id: I97f84dd04eb44e6a5d00cf9a2f6b24a5b3e9297f
2017-01-20 11:20:36 -08: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
ef0a090e6f bootstat: Log ro.boottime.init timing properties.
Bug: none
Test: adb logcat | grep bootstat
Change-Id: I3375c75e8ef39be710c8001f19a9e2fb493805e9
2017-01-06 14:52:52 -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
Mark Salyzyn
472245d962 liblog: move android_log_event_context class to log/log_event_list.h
rename class from android_log_event_context to android_log_event_list

Test: gTest logcat-unit-tests
Bug: 31992412
Bug: 31456426
Change-Id: Ib61cbca7d453837d64959c56b0e11f8c5edbfbdd
2016-11-21 09:46:34 -08:00
Mark Salyzyn
343b76e449 bootstat: drop event_log_list_builder
Use android_log_event_context class instead

Test: manual
Bug: 31456426
Bug: 31750617
Bug: 30465923
Change-Id: I8c58d6bdd1fd921f32a1a6f42bec38937833c0e4
2016-10-24 11:13:16 -07:00
Mark Salyzyn
cfd5b080af system/core: preparation to pull back interfaces from android/log.h
Point to log/log.h where necessary, define LOG_TAG where necessary.
Accept that private/android_logger.h is suitable replacement for
log/logger.h and android/log.h.

Correct liblog/README

Effectively a cleanup and controlled select revert of
'system/core: drop or replace log/logger.h' and
'system/core: Replace log/log.h with android/log.h'.

Test: compile
Bug: 30465923
Change-Id: Ic2ad157bad6f5efe2c6af293a73bb753300b17a2
2016-10-20 08:11:39 -07:00
Elliott Hughes
da46b392f1 Move off std::sto* function which abort on failure.
Bug: http://b/31403370
Test: builds, boots, libbase tests pass
Change-Id: I89cd7ca3d8f1c8a1bad0ddf3043439449d19a293
2016-10-13 15:34:05 -07:00
Mark Salyzyn
ff2dcd9af9 system/core Replace log/log.h with android/log.h
Should use android/log.h instead of log/log.h as a good example
to all others.  Adjust header order to comply with Android Coding
standards.

Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I33a8fb4e754d2dc4754d335660c450e0a67190fc
2016-09-30 12:47:05 -07:00
Dan Willemsen
194edf772e Convert to Android.bp
See build/soong/README.md for more information.

I tested the following tests on a Nexus9 and linux host, and they
continued to pass:

/data/nativetest{,64}/bootstat_tests/bootstat_tests
out/host/linux-x86/bin/nativetest{,64}/bootstat_tests/bootstat_tests
/data/nativetest64/memunreachable_test/memunreachable_test
out/host/linux-x86/bin/nativetest{,64}/memunreachable_test/memunreachable_test

These continue to fail just like before this change:

/data/nativetest{,64}/sync_test/sync_test (was /system/bin/sync_test)
/data/nativetest{,64}/sync-unit-test/sync-unit-test
/data/nativetest/memunreachable_test/memunreachable_test

Test: See above
Change-Id: I691e564e0cf008dd363e3746223b153d712e024d
2016-08-26 16:19:21 -07:00
James Hawkins
4dded613b3 bootstat: Fix a potential unhandled exception for malformed input.
In rare cases the hardware storage on the device may be hosed and return
garbage.  Use ParseInt which handles bad input instead of stoi.

BUG: 29334139
Change-Id: I91aedc169df110bea8097775f73dda11def22311
2016-07-28 11:59:22 -07:00
Dan Albert
3df8c67d29 Don't hardcode gtest paths.
Bug: http://b/16574165
Change-Id: Icaf99a51c309db7eb5f8b051a5896b5f49e1b3bc
2016-04-26 13:28:23 -07:00
James Hawkins
2d8b3e66c6 bootstat: Calculate and log the time_since_last_boot metric.
Bug: 28163811
Change-Id: I2e1350531f6a0fc891c270cfdfca6c8ad63f8040
2016-04-15 08:44:01 -07:00
James Hawkins
b9cf77159a bootstat: Differentiate system update boot times.
Bug: 27454343
Change-Id: Idb2e6f55ad7dda546a486954201619bb73cee6b0
2016-04-08 15:32:19 -07:00
James Hawkins
fff95ba5dd bootstat: Two changes to aid in debugging TimeSinceFactoryReset.
* Also log to the BootEventRecordStore to check lossiness.
* Log factory_reset_current_time_failure separately.

Bug: 27550578
Change-Id: Id3d579a74a59ac28290cb7d6048765519f9ba59b
2016-03-29 16:13:49 -07:00
Elliott Hughes
2c5d1d7cd9 Add operator int() to unique_fd.
Change-Id: I7512559be7befbb8772d5529e06550267a2f1543
2016-03-28 12:15:36 -07:00
James Hawkins
c0dc139b4a Revert "Revert "bootstat: Handle v1 record files which do not contain file contents.""
This reverts commit 756b6a53a7.

The change is updated to use utimes (instead of futimens) since only
support for seconds resolution is required.

Bug: 27836969
Change-Id: I7134f759fb643e1a149158fcf6e20f76538b57d3
2016-03-25 14:26:13 -07:00
James Hawkins
756b6a53a7 Revert "bootstat: Handle v1 record files which do not contain file contents."
Breaks the darwin-x86 build.

This reverts commit 84fda19c83.

Change-Id: Ia55b5ba756ec2ba4195f493ea505d05f68a9c37e
2016-03-25 18:21:58 +00:00
James Hawkins
84fda19c83 bootstat: Handle v1 record files which do not contain file contents.
Bug: 27836969
Change-Id: I18fcdab7ca32d00af3f8827f42d47868492ed719
2016-03-25 09:34:44 -07:00
James Hawkins
6f28299d0d bootstat: Track record inconsistencies w/ a debug metric, bootstat_mtime_matches_content.
Fixed a file descriptor leak while I was in here.

Bug: 27550578
Change-Id: I8e252e4f5bb3c4e2ae96a1560fbb32ae636722a0
2016-03-22 16:02:01 -07:00
James Hawkins
c627558a48 bootstat: Add a value option to allow recording an associated value for a boot event.
This has been useful in debugging, but I could see it being used
practically.

Change-Id: Ied6e23d0f7a1bc39f606b2dba88fea92adc31bda
2016-03-22 11:45:59 -07: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
a347cde386 Merge "bootstat: Add more debug logging metrics to RecordFactoryReset." 2016-03-09 16:34:25 +00:00
James Hawkins
45ead35222 bootstat: Add more strings to the bootreason mapping.
Bug: 27555866
Change-Id: Ieebacaa9369a744d0968b3483c4302ed47bdf9f6
2016-03-08 16:42:07 -08:00
James Hawkins
0660b307b8 bootstat: Add more debug logging metrics to RecordFactoryReset.
In an effort to track down the source of some wonky data being reported.

Bug: 27550578
Change-Id: I1f08447c0203e7982d1b44bc04b531e96358c223
2016-03-08 16:18:15 -08:00
James Hawkins
c67ef7820f Merge "bootstat: Gate boot time metrics logging on an encrypted device being decrypted." 2016-03-04 19:30:56 +00:00
James Hawkins
3bf9b147f2 bootstat: Don't log time_since_factory_reset on device reset.
The zero value is meaningless and skews the histogram buckets.

Bug: 27477664
Change-Id: Idd641aa3005819905a2ecf664d2a5781dbbff59b
2016-03-03 14:50:24 -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
500d71566a bootstat: Record metrics for factory_reset and time_since_factory_reset.
Bug: 25448351
Change-Id: I9b3a557317bc256a078f76e2b65d16bc071e4a6a
2016-02-16 16:19:48 -08:00
James Hawkins
6f74c0b843 bootstat: Add a few more bootreasons and rebase the index against index 1.
This is necessary to match the mapping in the internal infrastructure.

Bug: 21724738
Change-Id: I292166ff5c0dea7f3d771627120f16af4c56073b
2016-02-13 09:54:35 -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
dac84b5a1a Merge "bootstat: Hook up bootstat to record the boot complete signal and log boot events in the LOCAL_INIT_RC file, bootstat.rc." 2016-01-26 21:30:55 +00: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
Ian Pedowitz
5699ee889a Removing -std=c++14 from bootstat Android.mk
From comments in 7e04be06d1, this
is not needed.

Change-Id: I427efac8d5e0750ea5f4e77e1582d134d9cae089
2016-01-22 20:33:04 -08:00
Rom Lemarchand
7e04be06d1 bootstat: Use Clang and c++14 standard
Change-Id: Ic156eea4d8731e67b26da0a56a7e69b13df659cb
2016-01-22 19:11:20 -08:00
James Hawkins
5cd4bc299b bootstat: Fix the build on git_mnc-dr1.5-dev-plus-aosp by adding missing
C++ includes

Bug: 21724738
Change-Id: I27e1e8d7897302a1f2d1e4d44c226450194f1933
2016-01-22 11:07:51 -08:00
James Hawkins
6d0d12a9d8 bootstat: Followup cleanups from the initial bootstat checkin.
* Clarify the README.md that the logs data may be utilized by anyone.
* Fix a whitespace issue.

Bug: 21724738
Change-Id: Id472485f505afb14588ccd645844a3f4a728abc2
2016-01-20 13:17:02 -08:00
James Hawkins
eabe08b55e bootstat: Fix the base includes to be AOSP-friendly.
Change-Id: I625cc55b41f5258addf3bb74bcef42063c565465
Bug: 21724738
2016-01-20 01:28:48 +00:00
James Hawkins
abd73e6179 system/core: Add initial implementation of the bootstat command.
The bootstat command enables the measurement and logging of boot time
metrics
for GMS devices.

BUG:21724738
Change-Id: I331456dd38a60fb4ef24a4d5320909dbad30db66
2016-01-19 15:10:38 -08:00