Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 6c852ae

Browse files
Siim SammulAndroid (Google) Code Review
authored andcommitted
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
2 parents 8e31f85 + 8f31e9d commit 6c852ae

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

core/java/com/android/internal/os/BinderCallsStats.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,9 @@ private void noteCallsStatsDelayed() {
220220
public CallSession callStarted(Binder binder, int code, int workSourceUid) {
221221
noteNativeThreadId();
222222

223+
boolean collectCpu = canCollect();
223224
// We always want to collect data for latency if it's enabled, regardless of device state.
224-
if (!mCollectLatencyData && !canCollect()) {
225+
if (!mCollectLatencyData && !collectCpu) {
225226
return null;
226227
}
227228

@@ -233,7 +234,7 @@ public CallSession callStarted(Binder binder, int code, int workSourceUid) {
233234
s.timeStarted = -1;
234235
s.recordedCall = shouldRecordDetailedData();
235236

236-
if (mRecordingAllTransactionsForUid || s.recordedCall) {
237+
if (collectCpu && (mRecordingAllTransactionsForUid || s.recordedCall)) {
237238
s.cpuTimeStarted = getThreadTimeMicro();
238239
s.timeStarted = getElapsedRealtimeMicro();
239240
} else if (mCollectLatencyData) {

0 commit comments

Comments
 (0)