package com.ss.android.ugc.aweme.benchmark;

import X.0MX;
import X.0Mf;
import X.0Mo;
import X.2te;
import X.2th;
import X.Lnj;
import com.benchmark.collection_api.BXCollectionAPI;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.ss.android.ugc.aweme.bl.IBenchmarkService;
import kotlin.h.b.n;

public final class BenchmarkServiceImpl implements IBenchmarkService {
    static {
        Covode.recordClassIndex(54586);
    }

    public final void stopBenchmark() {
        0MX r1 = 0MX.LIZ;
        n.LIZIZ(r1, "");
        BXCollectionAPI LIZ = r1.LIZ();
        if (LIZ != null) {
            LIZ.LIZIZ();
        }
    }

    public final void startBenchmark(int i) {
        0MX r1 = 0MX.LIZ;
        n.LIZIZ(r1, "");
        BXCollectionAPI LIZ = r1.LIZ();
        if (LIZ != null) {
            LIZ.LIZ(i);
        }
    }

    public static IBenchmarkService createIBenchmarkServicebyMonsterPlugin(boolean z) {
        MethodCollector.i(3744);
        IBenchmarkService iBenchmarkService = (IBenchmarkService) Lnj.LIZ(IBenchmarkService.class, z);
        if (iBenchmarkService != null) {
            MethodCollector.o(3744);
            return iBenchmarkService;
        }
        Object LIZIZ = Lnj.LIZIZ(IBenchmarkService.class, z);
        if (LIZIZ != null) {
            IBenchmarkService iBenchmarkService2 = (IBenchmarkService) LIZIZ;
            MethodCollector.o(3744);
            return iBenchmarkService2;
        }
        if (Lnj.LJJLI == null) {
            synchronized (IBenchmarkService.class) {
                try {
                    if (Lnj.LJJLI == null) {
                        Lnj.LJJLI = new BenchmarkServiceImpl();
                    }
                } catch (Throwable th) {
                    MethodCollector.o(3744);
                    throw th;
                }
            }
        }
        BenchmarkServiceImpl benchmarkServiceImpl = (BenchmarkServiceImpl) Lnj.LJJLI;
        MethodCollector.o(3744);
        return benchmarkServiceImpl;
    }

    public final float getBenchmarkOverallScore(int i, float f) {
        Object obj;
        try {
            obj = Float.valueOf(0Mo.LIZIZ.LIZ(i, 0Mf.LIZ.LJIIIZ, f));
            2te.constructor-impl(obj);
        } catch (Throwable th) {
            obj = 2th.LIZ(th);
            2te.constructor-impl(obj);
        }
        if (2te.isFailure-impl(obj)) {
            obj = null;
        }
        Float f2 = (Float) obj;
        if (f2 != null) {
            return f2.floatValue();
        }
        return f;
    }
}
