summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/metrics/Metrics.java
diff options
context:
space:
mode:
authorzachh <zachh@google.com>2018-03-02 17:14:35 -0800
committerCopybara-Service <copybara-piper@google.com>2018-03-02 17:49:09 -0800
commitdfded3aac2c4628f74cafdd2eb096f553d0d48ad (patch)
tree60b7743a32a7e236df2d8c19def6a3eb9b290b8b /java/com/android/dialer/metrics/Metrics.java
parent8b1491d22c4dc8226e192a9997b5200ca517c1c1 (diff)
Added timing to some more AnnotatedCallLog operations.
This includes: 1) Made RefreshAnnotatedCallLogWorker.refresh() methods return a result which is "not dirty", "dirty but no changes needed" or "dirty and changes need". It will be interesting to see how often these cases occur (will log impressions in a future CL) so I thought we might as well log the latency of each case separately as well. 2) To support 1) added a new method to FutureTimer which allows you to compute the event name from the result of the timed Future. Also needed to update the Metrics interface to support deferring the event name when starting a timer via a generic token. 3) Timing the coalesce operation which is very heavyweight. 4) Made StubMetrics do some logcat logging to easily observe timing information using AOSP Bug: 70989667 Test: unit PiperOrigin-RevId: 187691203 Change-Id: I5f19a2fc94d86639486299b65b0edd66eeaab52e
Diffstat (limited to 'java/com/android/dialer/metrics/Metrics.java')
-rw-r--r--java/com/android/dialer/metrics/Metrics.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/java/com/android/dialer/metrics/Metrics.java b/java/com/android/dialer/metrics/Metrics.java
index b460f3ecf..e9e22c353 100644
--- a/java/com/android/dialer/metrics/Metrics.java
+++ b/java/com/android/dialer/metrics/Metrics.java
@@ -17,6 +17,7 @@
package com.android.dialer.metrics;
import android.app.Application;
+import android.support.annotation.Nullable;
/** Logs metrics. */
public interface Metrics {
@@ -36,6 +37,14 @@ public interface Metrics {
String NEW_CALL_LOG_JANK_EVENT_NAME = "NewCallLog.Jank";
// Events related to refreshing the annotated call log.
+ String NEW_CALL_LOG_COALESCE = "NewCallLog.Coalesce";
+ String REFRESH_NOT_DIRTY = "RefreshAnnotatedCallLogReceiver.NotDirty";
+ String REFRESH_CHANGES_NEEDED = "RefreshAnnotatedCallLogReceiver.ChangesNeeded";
+ String REFRESH_NO_CHANGES_NEEDED = "RefreshAnnotatedCallLogReceiver.NoChangesNeeded";
+ String FORCE_REFRESH_CHANGES_NEEDED = "RefreshAnnotatedCallLogReceiver.ForceRefreshChangesNeeded";
+ String FORCE_REFRESH_NO_CHANGES_NEEDED =
+ "RefreshAnnotatedCallLogReceiver.ForceRefreshNoChangesNeeded";
+
String INITIAL_FILL_EVENT_NAME = "RefreshAnnotatedCallLog.Initial.Fill";
String INITIAL_ON_SUCCESSFUL_FILL_EVENT_NAME = "RefreshAnnotatedCallLog.Initial.OnSuccessfulFill";
String INITIAL_APPLY_MUTATIONS_EVENT_NAME = "RefreshAnnotatedCallLog.Initial.ApplyMutations";
@@ -61,6 +70,23 @@ public interface Metrics {
/** Start a timer. */
void startTimer(String timerEventName);
+ /**
+ * Starts a timer for which the name is not yet known.
+ *
+ * @return opaque identifier for the event which should be provided back to {@link
+ * #stopUnnamedTimer(int, String)} to stop the timer. Null if the timer cannot be started, for
+ * example because the user is locked.
+ */
+ @Nullable
+ Integer startUnnamedTimer();
+
+ /**
+ * Stop a timer which was started with {@link #startUnnamedTimer()}.
+ *
+ * @param timerId the value returned in the corresponding call to {@link #startUnnamedTimer()}
+ */
+ void stopUnnamedTimer(int timerId, String timerEventName);
+
/** Stop a timer. */
void stopTimer(String timerEventName);