API reference
API reference
Select your platform
No SDKs available
No versions available

PerfLogger

PerfLogger

object PerfLogger
Utility for measuring and tracking execution times of operations in the code.
PerfLogger provides a simple way to measure how long different operations take to execute. It stores timing information in a HashMap where the key is a string identifier for the operation and the value is a Pair containing the start and end times in milliseconds since system boot.
This logger is useful for performance profiling and identifying bottlenecks in your application.
Example usage:
// Start timing an operation
PerfLogger.startTiming("LoadMesh")

// Perform the operation
val mesh = loadMeshFromFile(file)

// End timing the operation
PerfLogger.endTiming("LoadMesh")

// Later, you can access the timing information
val timingPair = PerfLogger.timings["LoadMesh"]
val startTime = timingPair?.first
val endTime = timingPair?.second
val elapsedTime = if (startTime != null && endTime != null) endTime - startTime else null
println("Loading mesh took ${elapsedTime}ms")

Properties

NameSummary
timings
var timings: <Error class: unknown class><String, <Error class: unknown class><Long, Long>>

HashMap storing timing information for different operations.

Functions

NameSummary
endTiming
fun endTiming(beingTimed: String)

Ends timing for an operation and records the elapsed time.
startTiming
fun startTiming(beingTimed: String)

Starts timing an operation identified by the given string.
Did you find this page helpful?