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

Commit 5237f47b authored by Fyodor Kupolov's avatar Fyodor Kupolov
Browse files

Use push/peek/pop for operations on stack

Test: manual - device boots, metrics are logged to system/event log
Bug: 32780225
Change-Id: If7e51c50767d8fd9d5da44f61dbc5bfe56196894
parent 6ce1e98c
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -52,12 +52,11 @@ public class BootTimingsTraceLog {
        if (!DEBUG_BOOT_TIME) {
            return;
        }
        // Pop the top element without throwing NoSuchElementException
        Pair<String, Long> event = mStartTimes.pollFirst();
        if (event == null) {
        if (mStartTimes.peek() == null) {
            Slog.w(mTag, "traceEnd called more times than traceBegin");
            return;
        }
        Pair<String, Long> event = mStartTimes.pop();
        // Log the duration so it can be parsed by external tools for performance reporting
        Slog.d(mTag, event.first + " took to complete: "
                + (SystemClock.elapsedRealtime() - event.second) + "ms");