Profiler#
Types#
Generally, you do not need to instantiate CDP types yourself. Instead, the API creates objects for you as return values from commands, and then you can use those objects as arguments to other commands.
- class ProfileNode(id_, call_frame, hit_count=None, children=None, deopt_reason=None, position_ticks=None)[source]#
Profile node. Holds callsite information, execution statistics and child nodes.
-
deopt_reason:
Optional
[str
] = None# The reason of being not optimized. The function may be deoptimized or marked as don’t optimize.
-
position_ticks:
Optional
[List
[PositionTickInfo
]] = None# An array of source position ticks.
-
deopt_reason:
- class Profile(nodes, start_time, end_time, samples=None, time_deltas=None)[source]#
Profile.
-
nodes:
List
[ProfileNode
]# The list of profile nodes. First item is the root node.
-
nodes:
- class PositionTickInfo(line, ticks)[source]#
Specifies a number of samples attributed to a certain source position.
- class FunctionCoverage(function_name, ranges, is_block_coverage)[source]#
Coverage data for a JavaScript function.
-
ranges:
List
[CoverageRange
]# Source ranges inside the function with coverage data.
-
ranges:
Commands#
Each command is a generator function. The return
type Generator[x, y, z]
indicates that the generator
yields arguments of type x
, it must be resumed with
an argument of type y
, and it returns type z
. In
this library, types x
and y
are the same for all
commands, and z
is the return type you should pay attention
to. For more information, see
Getting Started: Commands.
- get_best_effort_coverage()[source]#
Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection.
- set_sampling_interval(interval)[source]#
Changes CPU profiler sampling interval. Must be called before CPU profiles recording started.
- start_precise_coverage(call_count=None, detailed=None, allow_triggered_updates=None)[source]#
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:
- Return type:
- Returns:
Monotonically increasing time (in seconds) when the coverage update was taken in the backend.
- stop_precise_coverage()[source]#
Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code.
Events#
Generally, you do not need to instantiate CDP events yourself. Instead, the API creates events for you and then you use the event’s attributes.
- class ConsoleProfileStarted(id_, location, title)[source]#
Sent when new profile recording is started using console.profile() call.
- class PreciseCoverageDeltaUpdate(timestamp, occasion, result)[source]#
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.-
timestamp:
float
# Monotonically increasing time (in seconds) when the coverage update was taken in the backend.
-
result:
List
[ScriptCoverage
]# Coverage data for the current isolate.
-
timestamp: