profiler
ConsoleProfileFinished
dataclass
Source code in zendriver/cdp/profiler.py
id_: str
instance-attribute
location: debugger.Location
instance-attribute
profile: Profile
instance-attribute
title: typing.Optional[str]
instance-attribute
__init__(id_, location, profile, title)
from_json(json)
classmethod
Source code in zendriver/cdp/profiler.py
ConsoleProfileStarted
dataclass
Sent when new profile recording is started using console.profile() call.
Source code in zendriver/cdp/profiler.py
id_: str
instance-attribute
location: debugger.Location
instance-attribute
title: typing.Optional[str]
instance-attribute
__init__(id_, location, title)
from_json(json)
classmethod
Source code in zendriver/cdp/profiler.py
CoverageRange
dataclass
Coverage data for a source range.
Source code in zendriver/cdp/profiler.py
count: int
instance-attribute
end_offset: int
instance-attribute
start_offset: int
instance-attribute
__init__(start_offset, end_offset, count)
from_json(json)
classmethod
FunctionCoverage
dataclass
Coverage data for a JavaScript function.
Source code in zendriver/cdp/profiler.py
function_name: str
instance-attribute
is_block_coverage: bool
instance-attribute
ranges: typing.List[CoverageRange]
instance-attribute
__init__(function_name, ranges, is_block_coverage)
from_json(json)
classmethod
Source code in zendriver/cdp/profiler.py
PositionTickInfo
dataclass
Specifies a number of samples attributed to a certain source position.
Source code in zendriver/cdp/profiler.py
line: int
instance-attribute
ticks: int
instance-attribute
__init__(line, ticks)
from_json(json)
classmethod
PreciseCoverageDeltaUpdate
dataclass
EXPERIMENTAL
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.
Source code in zendriver/cdp/profiler.py
occasion: str
instance-attribute
result: typing.List[ScriptCoverage]
instance-attribute
timestamp: float
instance-attribute
__init__(timestamp, occasion, result)
from_json(json)
classmethod
Profile
dataclass
Profile.
Source code in zendriver/cdp/profiler.py
end_time: float
instance-attribute
nodes: typing.List[ProfileNode]
instance-attribute
samples: typing.Optional[typing.List[int]] = None
class-attribute
instance-attribute
start_time: float
instance-attribute
time_deltas: typing.Optional[typing.List[int]] = None
class-attribute
instance-attribute
__init__(nodes, start_time, end_time, samples=None, time_deltas=None)
from_json(json)
classmethod
Source code in zendriver/cdp/profiler.py
to_json()
Source code in zendriver/cdp/profiler.py
ProfileNode
dataclass
Profile node. Holds callsite information, execution statistics and child nodes.
Source code in zendriver/cdp/profiler.py
call_frame: runtime.CallFrame
instance-attribute
children: typing.Optional[typing.List[int]] = None
class-attribute
instance-attribute
deopt_reason: typing.Optional[str] = None
class-attribute
instance-attribute
hit_count: typing.Optional[int] = None
class-attribute
instance-attribute
id_: int
instance-attribute
position_ticks: typing.Optional[typing.List[PositionTickInfo]] = None
class-attribute
instance-attribute
__init__(id_, call_frame, hit_count=None, children=None, deopt_reason=None, position_ticks=None)
from_json(json)
classmethod
Source code in zendriver/cdp/profiler.py
to_json()
Source code in zendriver/cdp/profiler.py
ScriptCoverage
dataclass
Coverage data for a JavaScript script.
Source code in zendriver/cdp/profiler.py
functions: typing.List[FunctionCoverage]
instance-attribute
script_id: runtime.ScriptId
instance-attribute
url: str
instance-attribute
__init__(script_id, url, functions)
from_json(json)
classmethod
disable()
enable()
get_best_effort_coverage()
Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection.
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[ScriptCoverage]]
|
Coverage data for the current isolate. |
Source code in zendriver/cdp/profiler.py
set_sampling_interval(interval)
Changes CPU profiler sampling interval. Must be called before CPU profiles recording started.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
interval
|
int
|
New sampling interval in microseconds. |
required |
Source code in zendriver/cdp/profiler.py
start()
start_precise_coverage(call_count=None, detailed=None, allow_triggered_updates=None)
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.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
call_count
|
Optional[bool]
|
(Optional) Collect accurate call counts beyond simple 'covered' or 'not covered'. |
None
|
detailed
|
Optional[bool]
|
(Optional) Collect block-based coverage. |
None
|
allow_triggered_updates
|
Optional[bool]
|
(Optional) Allow the backend to send updates on its own initiative |
None
|
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, float]
|
Monotonically increasing time (in seconds) when the coverage update was taken in the backend. |
Source code in zendriver/cdp/profiler.py
stop()
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Profile]
|
Recorded profile. |
Source code in zendriver/cdp/profiler.py
stop_precise_coverage()
Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code.
Source code in zendriver/cdp/profiler.py
take_precise_coverage()
Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started.
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Tuple[List[ScriptCoverage], float]]
|
A tuple with the following items: 0. result - Coverage data for the current isolate. 1. timestamp - Monotonically increasing time (in seconds) when the coverage update was taken in the backend. |