profiler

package
v0.157.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2026 License: MIT Imports: 3 Imported by: 8

Documentation

Overview

Package profiler provides the Chrome DevTools Protocol commands, types, and events for the Profiler domain.

Generated by the pdlgen command.

Index

Constants

View Source
const (
	CommandDisable               = "Profiler.disable"
	CommandEnable                = "Profiler.enable"
	CommandGetBestEffortCoverage = "Profiler.getBestEffortCoverage"
	CommandSetSamplingInterval   = "Profiler.setSamplingInterval"
	CommandStart                 = "Profiler.start"
	CommandStartPreciseCoverage  = "Profiler.startPreciseCoverage"
	CommandStop                  = "Profiler.stop"
	CommandStopPreciseCoverage   = "Profiler.stopPreciseCoverage"
	CommandTakePreciseCoverage   = "Profiler.takePreciseCoverage"
)

Command names.

Variables

View Source
var ConsoleProfileFinished = cdp.Event[EventConsoleProfileFinished]{Method: "Profiler.consoleProfileFinished"}

ConsoleProfileFinished [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#event-consoleProfileFinished

View Source
var ConsoleProfileStarted = cdp.Event[EventConsoleProfileStarted]{Method: "Profiler.consoleProfileStarted"}

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

See: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#event-consoleProfileStarted

View Source
var Disable = cdp.Command[cdp.Empty, cdp.Empty]{Method: CommandDisable}

Disable [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#method-disable

Enable [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#method-enable

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

See: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#method-getBestEffortCoverage

View Source
var PreciseCoverageDeltaUpdate = cdp.Event[EventPreciseCoverageDeltaUpdate]{Method: "Profiler.preciseCoverageDeltaUpdate"}

PreciseCoverageDeltaUpdate 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.

See: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#event-preciseCoverageDeltaUpdate

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

See: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#method-setSamplingInterval

Start [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#method-start

StartPreciseCoverage 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.

See: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#method-startPreciseCoverage

Stop [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#method-stop

View Source
var StopPreciseCoverage = cdp.Command[cdp.Empty, cdp.Empty]{Method: CommandStopPreciseCoverage}

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

See: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#method-stopPreciseCoverage

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

See: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#method-takePreciseCoverage

Functions

This section is empty.

Types

type CoverageRange

type CoverageRange struct {
	StartOffset int64 `json:"startOffset"` // JavaScript script source offset for the range start.
	EndOffset   int64 `json:"endOffset"`   // JavaScript script source offset for the range end.
	Count       int64 `json:"count"`       // Collected execution count of the source range.
}

CoverageRange coverage data for a source range.

See: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-CoverageRange

type EventConsoleProfileFinished

type EventConsoleProfileFinished struct {
	ID       string             `json:"id"`
	Location *debugger.Location `json:"location"` // Location of console.profileEnd().
	Profile  *Profile           `json:"profile"`
	Title    string             `json:"title,omitempty,omitzero"` // Profile title passed as an argument to console.profile().
}

EventConsoleProfileFinished [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#event-consoleProfileFinished

type EventConsoleProfileStarted

type EventConsoleProfileStarted struct {
	ID       string             `json:"id"`
	Location *debugger.Location `json:"location"`                 // Location of console.profile().
	Title    string             `json:"title,omitempty,omitzero"` // Profile title passed as an argument to console.profile().
}

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

See: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#event-consoleProfileStarted

type EventPreciseCoverageDeltaUpdate

type EventPreciseCoverageDeltaUpdate struct {
	Timestamp float64           `json:"timestamp"` // Monotonically increasing time (in seconds) when the coverage update was taken in the backend.
	Occasion  string            `json:"occasion"`  // Identifier for distinguishing coverage events.
	Result    []*ScriptCoverage `json:"result"`    // Coverage data for the current isolate.
}

EventPreciseCoverageDeltaUpdate 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.

See: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#event-preciseCoverageDeltaUpdate

type FunctionCoverage

type FunctionCoverage struct {
	FunctionName    string           `json:"functionName"`    // JavaScript function name.
	Ranges          []*CoverageRange `json:"ranges"`          // Source ranges inside the function with coverage data.
	IsBlockCoverage bool             `json:"isBlockCoverage"` // Whether coverage data for this function has block granularity.
}

FunctionCoverage coverage data for a JavaScript function.

See: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-FunctionCoverage

type GetBestEffortCoverageResult added in v0.157.3

type GetBestEffortCoverageResult struct {
	Result []*ScriptCoverage `json:"result,omitempty,omitzero"` // Coverage data for the current isolate.
}

GetBestEffortCoverageResult is the result of the command Profiler.getBestEffortCoverage.

type PositionTickInfo

type PositionTickInfo struct {
	Line  int64 `json:"line"`  // Source line number (1-based).
	Ticks int64 `json:"ticks"` // Number of samples attributed to the source line.
}

PositionTickInfo specifies a number of samples attributed to a certain source position.

See: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-PositionTickInfo

type Profile

type Profile struct {
	Nodes      []*ProfileNode `json:"nodes"`                         // The list of profile nodes. First item is the root node.
	StartTime  float64        `json:"startTime"`                     // Profiling start timestamp in microseconds.
	EndTime    float64        `json:"endTime"`                       // Profiling end timestamp in microseconds.
	Samples    []int64        `json:"samples,omitempty,omitzero"`    // Ids of samples top nodes.
	TimeDeltas []int64        `json:"timeDeltas,omitempty,omitzero"` // Time intervals between adjacent samples in microseconds. The first delta is relative to the profile startTime.
}

Profile Profile.

See: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-Profile

type ProfileNode

type ProfileNode struct {
	ID            int64               `json:"id"`                               // Unique id of the node.
	CallFrame     *runtime.CallFrame  `json:"callFrame"`                        // Function location.
	HitCount      int64               `json:"hitCount,omitempty,omitzero"`      // Number of samples where this node was on top of the call stack.
	Children      []int64             `json:"children,omitempty,omitzero"`      // Child node ids.
	DeoptReason   string              `json:"deoptReason,omitempty,omitzero"`   // The reason of being not optimized. The function may be deoptimized or marked as don't optimize.
	PositionTicks []*PositionTickInfo `json:"positionTicks,omitempty,omitzero"` // An array of source position ticks.
}

ProfileNode profile node. Holds callsite information, execution statistics and child nodes.

See: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-ProfileNode

type ScriptCoverage

type ScriptCoverage struct {
	ScriptID  cdp.ScriptID        `json:"scriptId"`  // JavaScript script id.
	URL       string              `json:"url"`       // JavaScript script name or url.
	Functions []*FunctionCoverage `json:"functions"` // Functions contained in the script that has coverage data.
}

ScriptCoverage coverage data for a JavaScript script.

See: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-ScriptCoverage

type SetSamplingIntervalParams

type SetSamplingIntervalParams struct {
	Interval int64 `json:"interval"` // New sampling interval in microseconds.
}

SetSamplingIntervalParams are the parameters of the command Profiler.setSamplingInterval.

type StartPreciseCoverageParams

type StartPreciseCoverageParams struct {
	CallCount             *bool `json:"callCount,omitempty,omitzero"`             // Collect accurate call counts beyond simple 'covered' or 'not covered'.
	Detailed              *bool `json:"detailed,omitempty,omitzero"`              // Collect block-based coverage.
	AllowTriggeredUpdates *bool `json:"allowTriggeredUpdates,omitempty,omitzero"` // Allow the backend to send updates on its own initiative
}

StartPreciseCoverageParams are the parameters of the command Profiler.startPreciseCoverage.

type StartPreciseCoverageResult added in v0.157.3

type StartPreciseCoverageResult struct {
	Timestamp float64 `json:"timestamp,omitempty,omitzero"` // Monotonically increasing time (in seconds) when the coverage update was taken in the backend.
}

StartPreciseCoverageResult is the result of the command Profiler.startPreciseCoverage.

type StopResult added in v0.157.3

type StopResult struct {
	Profile *Profile `json:"profile,omitempty,omitzero"` // Recorded profile.
}

StopResult is the result of the command Profiler.stop.

type TakePreciseCoverageResult added in v0.157.3

type TakePreciseCoverageResult struct {
	Result    []*ScriptCoverage `json:"result,omitempty,omitzero"`    // Coverage data for the current isolate.
	Timestamp float64           `json:"timestamp,omitempty,omitzero"` // Monotonically increasing time (in seconds) when the coverage update was taken in the backend.
}

TakePreciseCoverageResult is the result of the command Profiler.takePreciseCoverage.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL