package com.google.common.cache; import com.google.common.base.MoreObjects; import com.google.common.base.Objects; import com.google.common.base.Preconditions; import com.google.common.math.LongMath; import javax.annotation.CheckForNull; import tech.rabbit.r1launcher.BuildConfig; @ElementTypesAreNonnullByDefault /* loaded from: classes2.dex */ public final class CacheStats { private final long evictionCount; private final long hitCount; private final long loadExceptionCount; private final long loadSuccessCount; private final long missCount; private final long totalLoadTime; public long evictionCount() { return this.evictionCount; } public long hitCount() { return this.hitCount; } public long loadExceptionCount() { return this.loadExceptionCount; } public long loadSuccessCount() { return this.loadSuccessCount; } public long missCount() { return this.missCount; } public long totalLoadTime() { return this.totalLoadTime; } public CacheStats(long j, long j2, long j3, long j4, long j5, long j6) { Preconditions.checkArgument(j >= 0); Preconditions.checkArgument(j2 >= 0); Preconditions.checkArgument(j3 >= 0); Preconditions.checkArgument(j4 >= 0); Preconditions.checkArgument(j5 >= 0); Preconditions.checkArgument(j6 >= 0); this.hitCount = j; this.missCount = j2; this.loadSuccessCount = j3; this.loadExceptionCount = j4; this.totalLoadTime = j5; this.evictionCount = j6; } public long requestCount() { return LongMath.saturatedAdd(this.hitCount, this.missCount); } public double hitRate() { long requestCount = requestCount(); if (requestCount == 0) { return 1.0d; } return this.hitCount / requestCount; } public double missRate() { long requestCount = requestCount(); return requestCount == 0 ? BuildConfig.SENTRY_SAMPLE_RATE : this.missCount / requestCount; } public long loadCount() { return LongMath.saturatedAdd(this.loadSuccessCount, this.loadExceptionCount); } public double loadExceptionRate() { long saturatedAdd = LongMath.saturatedAdd(this.loadSuccessCount, this.loadExceptionCount); return saturatedAdd == 0 ? BuildConfig.SENTRY_SAMPLE_RATE : this.loadExceptionCount / saturatedAdd; } public double averageLoadPenalty() { long saturatedAdd = LongMath.saturatedAdd(this.loadSuccessCount, this.loadExceptionCount); return saturatedAdd == 0 ? BuildConfig.SENTRY_SAMPLE_RATE : this.totalLoadTime / saturatedAdd; } public CacheStats minus(CacheStats cacheStats) { return new CacheStats(Math.max(0L, LongMath.saturatedSubtract(this.hitCount, cacheStats.hitCount)), Math.max(0L, LongMath.saturatedSubtract(this.missCount, cacheStats.missCount)), Math.max(0L, LongMath.saturatedSubtract(this.loadSuccessCount, cacheStats.loadSuccessCount)), Math.max(0L, LongMath.saturatedSubtract(this.loadExceptionCount, cacheStats.loadExceptionCount)), Math.max(0L, LongMath.saturatedSubtract(this.totalLoadTime, cacheStats.totalLoadTime)), Math.max(0L, LongMath.saturatedSubtract(this.evictionCount, cacheStats.evictionCount))); } public CacheStats plus(CacheStats cacheStats) { return new CacheStats(LongMath.saturatedAdd(this.hitCount, cacheStats.hitCount), LongMath.saturatedAdd(this.missCount, cacheStats.missCount), LongMath.saturatedAdd(this.loadSuccessCount, cacheStats.loadSuccessCount), LongMath.saturatedAdd(this.loadExceptionCount, cacheStats.loadExceptionCount), LongMath.saturatedAdd(this.totalLoadTime, cacheStats.totalLoadTime), LongMath.saturatedAdd(this.evictionCount, cacheStats.evictionCount)); } public int hashCode() { return Objects.hashCode(Long.valueOf(this.hitCount), Long.valueOf(this.missCount), Long.valueOf(this.loadSuccessCount), Long.valueOf(this.loadExceptionCount), Long.valueOf(this.totalLoadTime), Long.valueOf(this.evictionCount)); } public boolean equals(@CheckForNull Object obj) { if (!(obj instanceof CacheStats)) { return false; } CacheStats cacheStats = (CacheStats) obj; return this.hitCount == cacheStats.hitCount && this.missCount == cacheStats.missCount && this.loadSuccessCount == cacheStats.loadSuccessCount && this.loadExceptionCount == cacheStats.loadExceptionCount && this.totalLoadTime == cacheStats.totalLoadTime && this.evictionCount == cacheStats.evictionCount; } public String toString() { return MoreObjects.toStringHelper(this).add("hitCount", this.hitCount).add("missCount", this.missCount).add("loadSuccessCount", this.loadSuccessCount).add("loadExceptionCount", this.loadExceptionCount).add("totalLoadTime", this.totalLoadTime).add("evictionCount", this.evictionCount).toString(); } }