package com.google.android.gms.internal.ads;

import android.os.SystemClock;
import java.util.ArrayList;

/* JADX INFO: loaded from: classes2.dex */
public final class nc {

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final boolean f14524c = oc.f15004a;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final ArrayList f14525a = new ArrayList();

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public boolean f14526b = false;

    public final synchronized void a(long j10, String str) {
        if (this.f14526b) {
            throw new IllegalStateException("Marker added to finished log");
        }
        this.f14525a.add(new mc(str, j10, SystemClock.elapsedRealtime()));
    }

    public final synchronized void b(String str) {
        this.f14526b = true;
        ArrayList<mc> arrayList = this.f14525a;
        long j10 = arrayList.size() == 0 ? 0L : ((mc) arrayList.get(arrayList.size() - 1)).f14055c - ((mc) arrayList.get(0)).f14055c;
        if (j10 > 0) {
            long j11 = ((mc) arrayList.get(0)).f14055c;
            oc.b("(%-4d ms) %s", Long.valueOf(j10), str);
            for (mc mcVar : arrayList) {
                long j12 = mcVar.f14055c;
                oc.b("(+%-4d) [%2d] %s", Long.valueOf(j12 - j11), Long.valueOf(mcVar.f14054b), mcVar.f14053a);
                j11 = j12;
            }
        }
    }

    public final void finalize() {
        if (this.f14526b) {
            return;
        }
        b("Request on the loose");
        oc.b("Marker log finalized without finish() - uncaught exit point for request", new Object[0]);
    }
}
