diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/DebugUtils.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/DebugUtils.kt index eafafe292..7d3d0719b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/DebugUtils.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/DebugUtils.kt @@ -152,7 +152,7 @@ fun debugState(context: Context) { inline fun logTime( debugMessage: String, - minToReportMs: Int = 0, + minToReportMs: Int = 1, block: () -> T, ): T = if (isDebug) { @@ -167,11 +167,14 @@ inline fun logTime( inline fun logTime( debugMessage: (T) -> String, + minToReportMs: Int = 1, block: () -> T, ): T = if (isDebug) { val (result, elapsed) = measureTimedValue(block) - Log.d("DEBUG-TIME", "${elapsed.toString(DurationUnit.MILLISECONDS, 3).padStart(12)}: ${debugMessage(result)}") + if (elapsed.inWholeMilliseconds > minToReportMs) { + Log.d("DEBUG-TIME", "${elapsed.toString(DurationUnit.MILLISECONDS, 3).padStart(12)}: ${debugMessage(result)}") + } result } else { block()