change /data/bugreports to /bugreports am: 04bbd5c6dd am: 8be42a8040 am: c740d0b56c
am: 48d4fe138e
Change-Id: I7d447d2b87937608a1cb8949b8065466a4b02e07
diff --git a/bootstat/bootstat.rc b/bootstat/bootstat.rc
index ba8f81c..c96e996 100644
--- a/bootstat/bootstat.rc
+++ b/bootstat/bootstat.rc
@@ -11,13 +11,8 @@
on post-fs-data && property:init.svc.bootanim=running
exec - root root -- /system/bin/bootstat -r post_decrypt_time_elapsed
-# The first marker, boot animation stopped, is considered the point at which
-# the user may interact with the device, so it is a good proxy for the boot
-# complete signal.
-#
-# The second marker ensures an encrypted device is decrypted before logging
-# boot time data.
-on property:init.svc.bootanim=stopped && property:vold.decrypt=trigger_restart_framework
+# Record boot complete metrics.
+on property:sys.boot_completed=1
# Record boot_complete and related stats (decryption, etc).
exec - root root -- /system/bin/bootstat --record_boot_complete
diff --git a/toolbox/top.c b/toolbox/top.c
index 6fda132..e70ea31 100644
--- a/toolbox/top.c
+++ b/toolbox/top.c
@@ -31,6 +31,7 @@
#include <ctype.h>
#include <dirent.h>
+#include <errno.h>
#include <grp.h>
#include <inttypes.h>
#include <pwd.h>
@@ -38,6 +39,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
+#include <time.h>
#include <unistd.h>
#include <cutils/sched_policy.h>
@@ -180,6 +182,11 @@
new_procs = old_procs = NULL;
read_procs();
+
+ // Pause 250ms to get better data and avoid divide by zero later (http://b/32478213).
+ struct timespec ts = { .tv_sec = 0, .tv_nsec = 250000000 };
+ TEMP_FAILURE_RETRY(nanosleep(&ts, &ts));
+
while ((iterations == -1) || (iterations-- > 0)) {
old_procs = new_procs;
num_old_procs = num_new_procs;