summaryrefslogtreecommitdiff
path: root/java/com/android/contacts/common/util/StopWatch.java
diff options
context:
space:
mode:
authorTobias Thierer <tobiast@google.com>2017-06-09 14:16:05 +0000
committerTobias Thierer <tobiast@google.com>2017-06-09 14:16:05 +0000
commitcded3beaf28a703e1ef8f71bbc6836e6806c3736 (patch)
treec1b5e8199b5996fc848e7455d04126b9cdbb3c39 /java/com/android/contacts/common/util/StopWatch.java
parentc67d658e7daa453fe9ad9fd1a37f81eaf2048c44 (diff)
Revert "Update AOSP Dialer source from internal google3 repository at cl/158012278. am: 91ce7d2a47"
This reverts commit c67d658e7daa453fe9ad9fd1a37f81eaf2048c44. Reason for revert: This CL broke the sailfish-userdebug_javac-all target on master. Change-Id: I9b54333a654c00154ca84f4ece84bea4f07cc19b
Diffstat (limited to 'java/com/android/contacts/common/util/StopWatch.java')
-rw-r--r--java/com/android/contacts/common/util/StopWatch.java28
1 files changed, 26 insertions, 2 deletions
diff --git a/java/com/android/contacts/common/util/StopWatch.java b/java/com/android/contacts/common/util/StopWatch.java
index 7986d1081..b944b9867 100644
--- a/java/com/android/contacts/common/util/StopWatch.java
+++ b/java/com/android/contacts/common/util/StopWatch.java
@@ -16,7 +16,7 @@
package com.android.contacts.common.util;
-import com.android.dialer.common.LogUtil;
+import android.util.Log;
import java.util.ArrayList;
/** A {@link StopWatch} records start, laps and stop, and print them to logcat. */
@@ -37,6 +37,11 @@ public class StopWatch {
return new StopWatch(label);
}
+ /** Return a dummy instance that does no operations. */
+ public static StopWatch getNullStopWatch() {
+ return NullStopWatch.INSTANCE;
+ }
+
/** Record a lap. */
public void lap(String lapLabel) {
mTimes.add(System.currentTimeMillis());
@@ -71,6 +76,25 @@ public class StopWatch {
sb.append(" ");
last = current;
}
- LogUtil.v(TAG, sb.toString());
+ Log.v(TAG, sb.toString());
+ }
+
+ private static class NullStopWatch extends StopWatch {
+
+ public static final NullStopWatch INSTANCE = new NullStopWatch();
+
+ public NullStopWatch() {
+ super(null);
+ }
+
+ @Override
+ public void lap(String lapLabel) {
+ // noop
+ }
+
+ @Override
+ public void stopAndLog(String TAG, int timeThresholdToLog) {
+ // noop
+ }
}
}