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

Commit 5d4fd8af authored by Marcin Oczeretko's avatar Marcin Oczeretko Committed by Android (Google) Code Review
Browse files

Merge "CpuStats - Change the field used for the debug entries"

parents cd2e4b51 8d861746
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -344,7 +344,7 @@ public class BinderCallsStats implements BinderInternal.Observer {
        callStat.recordedCallCount = 1;
        callStat.callCount = 1;
        callStat.methodName = "__DEBUG_" + variableName;
        callStat.maxReplySizeBytes = value;
        callStat.latencyMicros = value;
        return callStat;
    }

+1 −1
Original line number Diff line number Diff line
@@ -167,7 +167,7 @@ public class LooperStats implements Looper.Observer {
        final Entry entry = new Entry("__DEBUG_" + variableName);
        entry.messageCount = 1;
        entry.recordedMessageCount = 1;
        entry.maxDelayMillis = value;
        entry.totalLatencyMicro = value;
        return new ExportedEntry(entry);
    }

+3 −3
Original line number Diff line number Diff line
@@ -607,15 +607,15 @@ public class BinderCallsStatsTest {
        BinderCallsStats.ExportedCallStat debugEntry1 = callStats.get(0);
        assertEquals("", debugEntry1.className);
        assertEquals("__DEBUG_start_time_millis", debugEntry1.methodName);
        assertTrue(startTime <= debugEntry1.maxReplySizeBytes);
        assertTrue(startTime <= debugEntry1.latencyMicros);
        BinderCallsStats.ExportedCallStat debugEntry2 = callStats.get(1);
        assertEquals("", debugEntry2.className);
        assertEquals("__DEBUG_end_time_millis", debugEntry2.methodName);
        assertTrue(debugEntry1.maxReplySizeBytes <= debugEntry2.maxReplySizeBytes);
        assertTrue(debugEntry1.latencyMicros <= debugEntry2.latencyMicros);
        BinderCallsStats.ExportedCallStat debugEntry3 = callStats.get(2);
        assertEquals("", debugEntry3.className);
        assertEquals("__DEBUG_battery_time_millis", debugEntry3.methodName);
        assertTrue(debugEntry3.maxReplySizeBytes >= 0);
        assertTrue(debugEntry3.latencyMicros >= 0);
    }

    class TestBinderCallsStats extends BinderCallsStats {
+3 −3
Original line number Diff line number Diff line
@@ -442,15 +442,15 @@ public final class LooperStatsTest {
        LooperStats.ExportedEntry debugEntry1 = entries.get(1);
        assertThat(debugEntry1.handlerClassName).isEqualTo("");
        assertThat(debugEntry1.messageName).isEqualTo("__DEBUG_start_time_millis");
        assertThat(debugEntry1.maxDelayMillis).isEqualTo(looperStats.getStartTimeMillis());
        assertThat(debugEntry1.totalLatencyMicros).isEqualTo(looperStats.getStartTimeMillis());
        LooperStats.ExportedEntry debugEntry2 = entries.get(2);
        assertThat(debugEntry2.handlerClassName).isEqualTo("");
        assertThat(debugEntry2.messageName).isEqualTo("__DEBUG_end_time_millis");
        assertThat(debugEntry2.maxDelayMillis).isAtLeast(looperStats.getStartTimeMillis());
        assertThat(debugEntry2.totalLatencyMicros).isAtLeast(looperStats.getStartTimeMillis());
        LooperStats.ExportedEntry debugEntry3 = entries.get(3);
        assertThat(debugEntry3.handlerClassName).isEqualTo("");
        assertThat(debugEntry3.messageName).isEqualTo("__DEBUG_battery_time_millis");
        assertThat(debugEntry3.maxDelayMillis).isAtLeast(0L);
        assertThat(debugEntry3.totalLatencyMicros).isAtLeast(0L);
    }

    private static void assertThrows(Class<? extends Exception> exceptionClass, Runnable r) {