AndroidAPS/app/src/main/java/info/nightscout/androidaps/utils/Profiler.kt

17 lines
563 B
Kotlin
Raw Normal View History

2020-04-25 17:20:12 +02:00
package info.nightscout.androidaps.utils
2021-09-21 21:57:56 +02:00
import info.nightscout.androidaps.annotations.OpenForTesting
2021-12-10 15:19:19 +01:00
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.LTag
2020-04-25 17:20:12 +02:00
import javax.inject.Inject
import javax.inject.Singleton
2021-09-21 21:57:56 +02:00
@OpenForTesting
2020-04-25 17:20:12 +02:00
@Singleton
class Profiler @Inject constructor(val aapsLogger: AAPSLogger) {
fun log(lTag: LTag, function: String, start: Long) {
2021-10-15 13:24:22 +02:00
val milliseconds = System.currentTimeMillis() - start
aapsLogger.debug(lTag, ">>> $function <<< executed in $milliseconds milliseconds")
2020-04-25 17:20:12 +02:00
}
}