BrowserPerformanceMeter

class BrowserPerformanceMeter(plan: PerformancePlan = PerformancePlan())(source)

Browser-native clock and animation-frame execution, independent of an application's renderer. Action-to-next-frame latency is not GPU completion time or JavaScript CPU time. Closing cancels pending callbacks, releases application closures, and rejects an incomplete run.

Parameters

plan

successful warm-up and measured operations required by this run.

Constructors

Link copied to clipboard
constructor(plan: PerformancePlan = PerformancePlan())

Functions

Link copied to clipboard
fun close()

Terminally releases this meter; pending preparation or samples remain a failed interval.

Link copied to clipboard
fun measure(ready: () -> Boolean = { true }, beforeSample: (Int) -> Unit = {}, afterSample: (Int) -> Unit = {}, cleanup: () -> Unit = {}, operation: (Int) -> Unit): Promise<BrowserPerformanceSample>

Waits for application readiness, then measures actions through the following animation frame. Failure or timeout rejects the promise and cannot produce a successful interval. Arbitrary application callback failures must cross the asynchronous boundary with their original cause.