Created
July 9, 2020 12:06
-
-
Save Sloy/6692ed645701f5316073e0e3bf7f37fd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.firebase.perf.FirebasePerformance | |
object FirebasePerformanceWrapper { | |
fun <T> trace(name: String, block: () -> T): T { | |
val trace = runCatching { FirebasePerformance.getInstance().newTrace(name) }.getOrNull() | |
trace?.start() | |
val result = block() | |
trace?.stop() | |
return result | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment