OSDN Git Service

Collect status on uncrypt time cost
authorTianjie Xu <xunchang@google.com>
Fri, 9 Sep 2016 18:27:32 +0000 (11:27 -0700)
committerTianjie Xu <xunchang@google.com>
Fri, 9 Sep 2016 18:35:15 +0000 (11:35 -0700)
Read and report time cost of uncrypt (in seconds) from last_install.

Bug: 31383361

Change-Id: I283970c33b2a0324f2f51cde328e3e527eff7c58

core/java/android/os/RecoverySystem.java

index dd7be53..028e30a 100644 (file)
@@ -695,6 +695,7 @@ public class RecoverySystem {
             String line = null;
             int bytesWrittenInMiB = -1, bytesStashedInMiB = -1;
             int timeTotal = -1;
+            int uncryptTime = -1;
             int sourceVersion = -1;
             while ((line = in.readLine()) != null) {
                 // Here is an example of lines in last_install:
@@ -730,6 +731,8 @@ public class RecoverySystem {
 
                 if (line.startsWith("time")) {
                     timeTotal = scaled;
+                } else if (line.startsWith("uncrypt_time")) {
+                    uncryptTime = scaled;
                 } else if (line.startsWith("source_build")) {
                     sourceVersion = scaled;
                 } else if (line.startsWith("bytes_written")) {
@@ -745,6 +748,9 @@ public class RecoverySystem {
             if (timeTotal != -1) {
                 MetricsLogger.histogram(context, "ota_time_total", timeTotal);
             }
+            if (uncryptTime != -1) {
+                MetricsLogger.histogram(context, "ota_uncrypt_time", uncryptTime);
+            }
             if (sourceVersion != -1) {
                 MetricsLogger.histogram(context, "ota_source_version", sourceVersion);
             }