Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 55369290 authored by Olivier Gaillard's avatar Olivier Gaillard Committed by Android (Google) Code Review
Browse files

Merge "Move a few method calls outside the BinderCallsStats lock."

parents 974f58b4 8a760b91
Loading
Loading
Loading
Loading
+13 −5
Original line number Original line Diff line number Diff line
@@ -117,8 +117,20 @@ public class BinderCallsStats implements BinderInternal.Observer {
    }
    }


    private void processCallEnded(CallSession s, int parcelRequestSize, int parcelReplySize) {
    private void processCallEnded(CallSession s, int parcelRequestSize, int parcelReplySize) {
        synchronized (mLock) {
        // Non-negative time signals we need to record data for this call.
        final boolean recordCall = s.cpuTimeStarted >= 0;
        final long duration;
        final long latencyDuration;
        if (recordCall) {
            duration = getThreadTimeMicro() - s.cpuTimeStarted;
            latencyDuration = getElapsedRealtimeMicro() - s.timeStarted;
        } else {
            duration = 0;
            latencyDuration = 0;
        }
        final int callingUid = getCallingUid();
        final int callingUid = getCallingUid();

        synchronized (mLock) {
            UidEntry uidEntry = mUidEntries.get(callingUid);
            UidEntry uidEntry = mUidEntries.get(callingUid);
            if (uidEntry == null) {
            if (uidEntry == null) {
                uidEntry = new UidEntry(callingUid);
                uidEntry = new UidEntry(callingUid);
@@ -128,11 +140,7 @@ public class BinderCallsStats implements BinderInternal.Observer {
            CallStat callStat = uidEntry.getOrCreate(s.className, s.transactionCode);
            CallStat callStat = uidEntry.getOrCreate(s.className, s.transactionCode);
            callStat.callCount++;
            callStat.callCount++;


            // Non-negative time signals we need to record data for this call.
            final boolean recordCall = s.cpuTimeStarted >= 0;
            if (recordCall) {
            if (recordCall) {
                final long duration = getThreadTimeMicro() - s.cpuTimeStarted;
                final long latencyDuration = getElapsedRealtimeMicro() - s.timeStarted;
                uidEntry.cpuTimeMicros += duration;
                uidEntry.cpuTimeMicros += duration;
                uidEntry.recordedCallCount++;
                uidEntry.recordedCallCount++;