package com.tisawesomeness.minecord.debug;

import com.google.common.cache.CacheStats;
import lombok.NonNull;

/**
 * Debugs a Guava {@link com.google.common.cache.LoadingCache}.
 */
public abstract class CacheDebugOption implements DebugOption {
    public @NonNull String debug() {
        CacheStats stats = getCacheStats();
        return String.format("**%s Stats**\n", getName()) +
                String.format("Hits: `%s/%s %.2f%%`\n", stats.hitCount(), stats.requestCount(), stats.hitRate()) +
                String.format("Load Exceptions: `%s/%s %.2f%%`\n", stats.loadExceptionCount(), stats.loadCount(), 100*stats.loadExceptionRate()) +
                String.format("Eviction Count: `%s`\n", stats.evictionCount()) +
                String.format("Average Load Penalty: `%.3fms`", stats.averageLoadPenalty() / 1_000_000);
    }
    /**
     * @return The cache stats to be used in {@link #debug()}.
     */
    public abstract @NonNull CacheStats getCacheStats();
}

@@ -240,16 +240,17 @@
 ption %7B%0A
+%0A
     publ
@@ -786,16 +786,18 @@
 %60%25.3fms%60
+%5Cn
 %22, stats
@@ -819,16 +819,110 @@
 alty() /
+ 1_000_000) +%0A                String.format(%22Total Load Time: %60%25sms%60%22, stats.totalLoadTime() /
  1_000_0

Add total load time to cache debug options