profiler

package
v0.34.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: MIT Imports: 5 Imported by: 6

Documentation

Overview

Package profiler implements the Profiler domain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(conn *rpcc.Conn) *domainClient

NewClient returns a client for the Profiler domain with the connection set to conn.

Types

type ConsoleProfileFinishedClient

type ConsoleProfileFinishedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*ConsoleProfileFinishedReply, error)
	rpcc.Stream
}

ConsoleProfileFinishedClient is a client for ConsoleProfileFinished events.

type ConsoleProfileFinishedReply

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

ConsoleProfileFinishedReply is the reply for ConsoleProfileFinished events.

type ConsoleProfileStartedClient

type ConsoleProfileStartedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*ConsoleProfileStartedReply, error)
	rpcc.Stream
}

ConsoleProfileStartedClient is a client for ConsoleProfileStarted events. Sent when new profile recording is started using console.profile() call.

type ConsoleProfileStartedReply

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

ConsoleProfileStartedReply is the reply for ConsoleProfileStarted events.

type CoverageRange

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

CoverageRange Coverage data for a source range.

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.

type GetBestEffortCoverageReply

type GetBestEffortCoverageReply struct {
	Result []ScriptCoverage `json:"result"` // Coverage data for the current isolate.
}

GetBestEffortCoverageReply represents the return values for GetBestEffortCoverage in the Profiler domain.

type PositionTickInfo

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

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

type PreciseCoverageDeltaUpdateClient added in v0.26.0

type PreciseCoverageDeltaUpdateClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*PreciseCoverageDeltaUpdateReply, error)
	rpcc.Stream
}

PreciseCoverageDeltaUpdateClient is a client for PreciseCoverageDeltaUpdate events. 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.

type PreciseCoverageDeltaUpdateReply added in v0.26.0

type PreciseCoverageDeltaUpdateReply 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.
}

PreciseCoverageDeltaUpdateReply is the reply for PreciseCoverageDeltaUpdate events.

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    []int         `json:"samples,omitempty"`    // Ids of samples top nodes.
	TimeDeltas []int         `json:"timeDeltas,omitempty"` // Time intervals between adjacent samples in microseconds. The first delta is relative to the profile startTime.
}

Profile Profile.

type ProfileNode

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

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

type ScriptCoverage

type ScriptCoverage struct {
	ScriptID  runtime.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.

type ScriptTypeProfile added in v0.13.1

type ScriptTypeProfile struct {
	ScriptID runtime.ScriptID   `json:"scriptId"` // JavaScript script id.
	URL      string             `json:"url"`      // JavaScript script name or url.
	Entries  []TypeProfileEntry `json:"entries"`  // Type profile entries for parameters and return values of the functions in the script.
}

ScriptTypeProfile Type profile data collected during runtime for a JavaScript script.

Note: This type is experimental.

type SetSamplingIntervalArgs

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

SetSamplingIntervalArgs represents the arguments for SetSamplingInterval in the Profiler domain.

func NewSetSamplingIntervalArgs

func NewSetSamplingIntervalArgs(interval int) *SetSamplingIntervalArgs

NewSetSamplingIntervalArgs initializes SetSamplingIntervalArgs with the required arguments.

type StartPreciseCoverageArgs

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

StartPreciseCoverageArgs represents the arguments for StartPreciseCoverage in the Profiler domain.

func NewStartPreciseCoverageArgs

func NewStartPreciseCoverageArgs() *StartPreciseCoverageArgs

NewStartPreciseCoverageArgs initializes StartPreciseCoverageArgs with the required arguments.

func (*StartPreciseCoverageArgs) SetAllowTriggeredUpdates added in v0.26.0

func (a *StartPreciseCoverageArgs) SetAllowTriggeredUpdates(allowTriggeredUpdates bool) *StartPreciseCoverageArgs

SetAllowTriggeredUpdates sets the AllowTriggeredUpdates optional argument. Allow the backend to send updates on its own initiative

func (*StartPreciseCoverageArgs) SetCallCount

func (a *StartPreciseCoverageArgs) SetCallCount(callCount bool) *StartPreciseCoverageArgs

SetCallCount sets the CallCount optional argument. Collect accurate call counts beyond simple 'covered' or 'not covered'.

func (*StartPreciseCoverageArgs) SetDetailed added in v0.11.4

func (a *StartPreciseCoverageArgs) SetDetailed(detailed bool) *StartPreciseCoverageArgs

SetDetailed sets the Detailed optional argument. Collect block-based coverage.

type StartPreciseCoverageReply added in v0.26.0

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

StartPreciseCoverageReply represents the return values for StartPreciseCoverage in the Profiler domain.

type StopReply

type StopReply struct {
	Profile Profile `json:"profile"` // Recorded profile.
}

StopReply represents the return values for Stop in the Profiler domain.

type TakePreciseCoverageReply

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

TakePreciseCoverageReply represents the return values for TakePreciseCoverage in the Profiler domain.

type TakeTypeProfileReply added in v0.13.1

type TakeTypeProfileReply struct {
	Result []ScriptTypeProfile `json:"result"` // Type profile for all scripts since startTypeProfile() was turned on.
}

TakeTypeProfileReply represents the return values for TakeTypeProfile in the Profiler domain.

type TypeObject added in v0.13.1

type TypeObject struct {
	Name string `json:"name"` // Name of a type collected with type profiling.
}

TypeObject Describes a type collected during runtime.

Note: This type is experimental.

type TypeProfileEntry added in v0.13.1

type TypeProfileEntry struct {
	Offset int          `json:"offset"` // Source offset of the parameter or end of function for return values.
	Types  []TypeObject `json:"types"`  // The types for this parameter or return value.
}

TypeProfileEntry Source offset and types for a parameter or return value.

Note: This type is experimental.

Jump to

Keyboard shortcuts

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