Merge "Correct trace name of LatencyTracker" into sc-dev am: 67c5128909
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13410410 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I22d2af041583d130a7f39c95b1a76b610d274ea4
This commit is contained in:
@@ -106,7 +106,6 @@ public class LatencyTracker {
|
|||||||
private static LatencyTracker sLatencyTracker;
|
private static LatencyTracker sLatencyTracker;
|
||||||
|
|
||||||
private final SparseLongArray mStartRtc = new SparseLongArray();
|
private final SparseLongArray mStartRtc = new SparseLongArray();
|
||||||
private final Context mContext;
|
|
||||||
private volatile int mSamplingInterval;
|
private volatile int mSamplingInterval;
|
||||||
private volatile boolean mEnabled;
|
private volatile boolean mEnabled;
|
||||||
|
|
||||||
@@ -114,15 +113,14 @@ public class LatencyTracker {
|
|||||||
if (sLatencyTracker == null) {
|
if (sLatencyTracker == null) {
|
||||||
synchronized (LatencyTracker.class) {
|
synchronized (LatencyTracker.class) {
|
||||||
if (sLatencyTracker == null) {
|
if (sLatencyTracker == null) {
|
||||||
sLatencyTracker = new LatencyTracker(context);
|
sLatencyTracker = new LatencyTracker();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sLatencyTracker;
|
return sLatencyTracker;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LatencyTracker(Context context) {
|
private LatencyTracker() {
|
||||||
mContext = context;
|
|
||||||
mEnabled = DEFAULT_ENABLED;
|
mEnabled = DEFAULT_ENABLED;
|
||||||
mSamplingInterval = DEFAULT_SAMPLING_INTERVAL;
|
mSamplingInterval = DEFAULT_SAMPLING_INTERVAL;
|
||||||
|
|
||||||
@@ -173,8 +171,8 @@ public class LatencyTracker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getTraceNameOfAcion(int action) {
|
private static String getTraceNameOfAction(int action) {
|
||||||
return "L<" + getNameOfAction(action) + ">";
|
return "L<" + getNameOfAction(STATSD_ACTION[action]) + ">";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEnabled(Context ctx) {
|
public static boolean isEnabled(Context ctx) {
|
||||||
@@ -194,7 +192,7 @@ public class LatencyTracker {
|
|||||||
if (!isEnabled()) {
|
if (!isEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Trace.asyncTraceBegin(Trace.TRACE_TAG_APP, getTraceNameOfAcion(action), 0);
|
Trace.asyncTraceBegin(Trace.TRACE_TAG_APP, getTraceNameOfAction(action), 0);
|
||||||
mStartRtc.put(action, SystemClock.elapsedRealtime());
|
mStartRtc.put(action, SystemClock.elapsedRealtime());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,7 +211,7 @@ public class LatencyTracker {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mStartRtc.delete(action);
|
mStartRtc.delete(action);
|
||||||
Trace.asyncTraceEnd(Trace.TRACE_TAG_APP, getTraceNameOfAcion(action), 0);
|
Trace.asyncTraceEnd(Trace.TRACE_TAG_APP, getTraceNameOfAction(action), 0);
|
||||||
logAction(action, (int) (endRtc - startRtc));
|
logAction(action, (int) (endRtc - startRtc));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,7 +234,7 @@ public class LatencyTracker {
|
|||||||
* @param writeToStatsLog Whether to write the measured latency to FrameworkStatsLog.
|
* @param writeToStatsLog Whether to write the measured latency to FrameworkStatsLog.
|
||||||
*/
|
*/
|
||||||
public static void logActionDeprecated(int action, int duration, boolean writeToStatsLog) {
|
public static void logActionDeprecated(int action, int duration, boolean writeToStatsLog) {
|
||||||
Log.i(TAG, "action=" + action + " latency=" + duration);
|
Log.i(TAG, getNameOfAction(STATSD_ACTION[action]) + " latency=" + duration);
|
||||||
EventLog.writeEvent(EventLogTags.SYSUI_LATENCY, action, duration);
|
EventLog.writeEvent(EventLogTags.SYSUI_LATENCY, action, duration);
|
||||||
|
|
||||||
if (writeToStatsLog) {
|
if (writeToStatsLog) {
|
||||||
|
|||||||
Reference in New Issue
Block a user