Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: base/android/java/src/org/chromium/base/SecureRandomInitializer.java

Issue 1583233004: Measure time spent during StrictMode violations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SecureRandomInitializer.java Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/android/java/src/org/chromium/base/SecureRandomInitializer.java
diff --git a/base/android/java/src/org/chromium/base/SecureRandomInitializer.java b/base/android/java/src/org/chromium/base/SecureRandomInitializer.java
index 457e2ef8b913606fc71f3209a7e6ea6e0c95e405..1d83876de5bf2b5700a64b5e03bd5b08dce9cfb2 100644
--- a/base/android/java/src/org/chromium/base/SecureRandomInitializer.java
+++ b/base/android/java/src/org/chromium/base/SecureRandomInitializer.java
@@ -4,9 +4,14 @@
package org.chromium.base;
+import android.os.SystemClock;
+
+import org.chromium.base.metrics.RecordHistogram;
+
import java.io.FileInputStream;
import java.io.IOException;
import java.security.SecureRandom;
+import java.util.concurrent.TimeUnit;
/**
* This class contains code to initialize a SecureRandom generator securely on Android platforms
@@ -22,6 +27,7 @@ public class SecureRandomInitializer {
* Safely initializes the random number generator, by seeding it with data from /dev/urandom.
*/
public static void initialize(SecureRandom generator) throws IOException {
+ long time = SystemClock.elapsedRealtime();
Yaron 2016/01/21 20:48:15 I think Ted already fixed this crbug/556599
Peter Wen 2016/01/21 20:59:45 Acknowledged.
FileInputStream fis = null;
try {
fis = new FileInputStream("/dev/urandom");
@@ -38,5 +44,7 @@ public class SecureRandomInitializer {
// Ignore exception closing the device.
}
}
+ RecordHistogram.recordTimesHistogram("Android.StrictMode.SecureRandomInitialize",
+ SystemClock.elapsedRealtime() - time, TimeUnit.MILLISECONDS);
}
}

Powered by Google App Engine
This is Rietveld 408576698