Profiler

class Profiler(cdp: CDP) : Domain

Constructors

Link copied to clipboard
constructor(cdp: CDP)

Types

Link copied to clipboard
@Serializable
data class ConsoleProfileFinishedParameter(val id: String, val location: Debugger.Location, val profile: Profiler.Profile, val title: String? = null)
Link copied to clipboard
@Serializable
data class ConsoleProfileStartedParameter(val id: String, val location: Debugger.Location, val title: String? = null)

Sent when new profile recording is started using console.profile() call.

Link copied to clipboard
@Serializable
data class CoverageRange(val startOffset: Int, val endOffset: Int, val count: Int)

Coverage data for a source range.

Link copied to clipboard
@Serializable
data class FunctionCoverage(val functionName: String, val ranges: List<Profiler.CoverageRange>, val isBlockCoverage: Boolean)

Coverage data for a JavaScript function.

Link copied to clipboard
@Serializable
data class GetBestEffortCoverageReturn(val result: List<Profiler.ScriptCoverage>)
Link copied to clipboard
@Serializable
data class PositionTickInfo(val line: Int, val ticks: Int)

Specifies a number of samples attributed to a certain source position.

Link copied to clipboard
@Serializable
data class PreciseCoverageDeltaUpdateParameter(val timestamp: Double, val occasion: String, val result: List<Profiler.ScriptCoverage>)

Reports coverage delta since the last poll (either from an event like this, or from takePreciseCoverage for the current isolate. May only be sent if precise code coverage has been started. This event can be trigged by the embedder to, for example, trigger collection of coverage data immediately at a certain point in time.

Link copied to clipboard
@Serializable
data class Profile(val nodes: List<Profiler.ProfileNode>, val startTime: Double, val endTime: Double, val samples: List<Int>? = null, val timeDeltas: List<Int>? = null)

Profile.

Link copied to clipboard
@Serializable
data class ProfileNode(val id: Int, val callFrame: Runtime.CallFrame, val hitCount: Int? = null, val children: List<Int>? = null, val deoptReason: String? = null, val positionTicks: List<Profiler.PositionTickInfo>? = null)

Profile node. Holds callsite information, execution statistics and child nodes.

Link copied to clipboard
@Serializable
data class ScriptCoverage(val scriptId: String, val url: String, val functions: List<Profiler.FunctionCoverage>)

Coverage data for a JavaScript script.

Link copied to clipboard
@Serializable
data class SetSamplingIntervalParameter(val interval: Int)
Link copied to clipboard
@Serializable
data class StartPreciseCoverageParameter(val callCount: Boolean? = null, val detailed: Boolean? = null, val allowTriggeredUpdates: Boolean? = null)
Link copied to clipboard
@Serializable
data class StartPreciseCoverageReturn(val timestamp: Double)
Link copied to clipboard
@Serializable
data class StopReturn(val profile: Profiler.Profile)
Link copied to clipboard
@Serializable
data class TakePreciseCoverageReturn(val result: List<Profiler.ScriptCoverage>, val timestamp: Double)

Properties

Link copied to clipboard

Sent when new profile recording is started using console.profile() call.

Link copied to clipboard

Reports coverage delta since the last poll (either from an event like this, or from takePreciseCoverage for the current isolate. May only be sent if precise code coverage has been started. This event can be trigged by the embedder to, for example, trigger collection of coverage data immediately at a certain point in time.

Functions

Link copied to clipboard
suspend fun disable(mode: CommandMode = CommandMode.DEFAULT)
Link copied to clipboard
suspend fun enable(mode: CommandMode = CommandMode.DEFAULT)
Link copied to clipboard

Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection.

Link copied to clipboard
suspend fun setSamplingInterval(interval: Int)
suspend fun setSamplingInterval(args: Profiler.SetSamplingIntervalParameter, mode: CommandMode = CommandMode.DEFAULT)

Changes CPU profiler sampling interval. Must be called before CPU profiles recording started.

Link copied to clipboard
suspend fun start(mode: CommandMode = CommandMode.DEFAULT)
Link copied to clipboard
suspend fun startPreciseCoverage(callCount: Boolean? = null, detailed: Boolean? = null, allowTriggeredUpdates: Boolean? = null): Profiler.StartPreciseCoverageReturn

Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters.

Link copied to clipboard
suspend fun stop(mode: CommandMode = CommandMode.DEFAULT): Profiler.StopReturn
Link copied to clipboard
suspend fun stopPreciseCoverage(mode: CommandMode = CommandMode.DEFAULT)

Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code.

Link copied to clipboard
suspend fun takePreciseCoverage(mode: CommandMode = CommandMode.DEFAULT): Profiler.TakePreciseCoverageReturn

Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started.