Merge "Do not make a getThreadTimeMicro() call when it is not needed. This was accidentally changed with https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15080830" into sc-dev

This commit is contained in:
Siim Sammul
2021-07-26 09:14:43 +00:00
committed by Android (Google) Code Review

View File

@@ -220,8 +220,9 @@ public class BinderCallsStats implements BinderInternal.Observer {
public CallSession callStarted(Binder binder, int code, int workSourceUid) { public CallSession callStarted(Binder binder, int code, int workSourceUid) {
noteNativeThreadId(); noteNativeThreadId();
boolean collectCpu = canCollect();
// We always want to collect data for latency if it's enabled, regardless of device state. // We always want to collect data for latency if it's enabled, regardless of device state.
if (!mCollectLatencyData && !canCollect()) { if (!mCollectLatencyData && !collectCpu) {
return null; return null;
} }
@@ -233,7 +234,7 @@ public class BinderCallsStats implements BinderInternal.Observer {
s.timeStarted = -1; s.timeStarted = -1;
s.recordedCall = shouldRecordDetailedData(); s.recordedCall = shouldRecordDetailedData();
if (mRecordingAllTransactionsForUid || s.recordedCall) { if (collectCpu && (mRecordingAllTransactionsForUid || s.recordedCall)) {
s.cpuTimeStarted = getThreadTimeMicro(); s.cpuTimeStarted = getThreadTimeMicro();
s.timeStarted = getElapsedRealtimeMicro(); s.timeStarted = getElapsedRealtimeMicro();
} else if (mCollectLatencyData) { } else if (mCollectLatencyData) {