PerformanceScenarioMeasurer

@MainThread
class PerformanceScenarioMeasurer(scenarioName: String)

Can be used to measure scenarios within the same process. The result will be logged in Logcat as a trace event.

A single instance only allows measuring one scenario at a time. Calling scenarioStarted() multiple times before scenarioFinished() is called will result in restarting the starting time for the scenario.

E.g.:

val measurer = PerformanceScenarioMeasurer("MyPerformanceScenario")
measurer.scenarioStarted()

// Here the scenario that will be measured.
...

measurer.scenarioFinished()

Logcat output: "I PerformanceScenarioMeasurer: event=performanceScenarioRecorded(MyPerformanceScenario, 1.79s)"

Constructors

Link copied to clipboard
fun PerformanceScenarioMeasurer(scenarioName: String)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun scenarioFinished()

Finishes measuring scenario.

Link copied to clipboard
fun scenarioStarted()

Starts measuring scenario.