HeapProfiler#
This CDP domain is experimental.
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 SamplingHeapProfileNode(call_frame, self_size, id_, children)[source]#
Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes.
-
id_:
int# Node id. Ids are unique across all profiles collected between startSampling and stopSampling.
-
children:
List[SamplingHeapProfileNode]# Child nodes.
-
id_:
- class SamplingHeapProfileSample(size, node_id, ordinal)[source]#
A single sample from a sampling profile.
- class SamplingHeapProfile(head, samples)[source]#
Sampling profile.
-
head:
SamplingHeapProfileNode#
-
samples:
List[SamplingHeapProfileSample]#
-
head:
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.
- add_inspected_heap_object(heap_object_id)[source]#
Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions).
- get_heap_object_id(object_id)[source]#
- Parameters:
object_id (
RemoteObjectId) – Identifier of the object to get heap object id for.- Return type:
Generator[Dict[str,Any],Dict[str,Any],HeapSnapshotObjectId]- Returns:
Id of the heap snapshot object corresponding to the passed remote object id.
- start_sampling(sampling_interval=None, include_objects_collected_by_major_gc=None, include_objects_collected_by_minor_gc=None)[source]#
- Parameters:
sampling_interval (
Optional[float]) – (Optional) Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes.include_objects_collected_by_major_gc (
Optional[bool]) – (Optional) By default, the sampling heap profiler reports only objects which are still alive when the profile is returned via getSamplingProfile or stopSampling, which is useful for determining what functions contribute the most to steady-state memory usage. This flag instructs the sampling heap profiler to also include information about objects discarded by major GC, which will show which functions cause large temporary memory usage or long GC pauses.include_objects_collected_by_minor_gc (
Optional[bool]) – (Optional) By default, the sampling heap profiler reports only objects which are still alive when the profile is returned via getSamplingProfile or stopSampling, which is useful for determining what functions contribute the most to steady-state memory usage. This flag instructs the sampling heap profiler to also include information about objects discarded by minor GC, which is useful when tuning a latency-sensitive application for minimal GC activity.
- Return type:
- stop_tracking_heap_objects(report_progress=None, treat_global_objects_as_roots=None, capture_numeric_value=None, expose_internals=None)[source]#
- Parameters:
report_progress (
Optional[bool]) – (Optional) If true ‘reportHeapSnapshotProgress’ events will be generated while snapshot is being taken when the tracking is stopped.treat_global_objects_as_roots (
Optional[bool]) – (DEPRECATED) (Optional) Deprecated in favor of`exposeInternals`.capture_numeric_value (
Optional[bool]) – (Optional) If true, numerical values are included in the snapshotexpose_internals (
Optional[bool]) – (EXPERIMENTAL) (Optional) If true, exposes internals of the snapshot.
- Return type:
- take_heap_snapshot(report_progress=None, treat_global_objects_as_roots=None, capture_numeric_value=None, expose_internals=None)[source]#
- Parameters:
report_progress (
Optional[bool]) – (Optional) If true ‘reportHeapSnapshotProgress’ events will be generated while snapshot is being taken.treat_global_objects_as_roots (
Optional[bool]) – (DEPRECATED) (Optional) If true, a raw snapshot without artificial roots will be generated. Deprecated in favor of`exposeInternals`.capture_numeric_value (
Optional[bool]) – (Optional) If true, numerical values are included in the snapshotexpose_internals (
Optional[bool]) – (EXPERIMENTAL) (Optional) If true, exposes internals of the snapshot.
- Return type:
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 HeapStatsUpdate(stats_update)[source]#
If heap objects tracking has been started then backend may send update for one or more fragments
- class LastSeenObjectId(last_seen_object_id, timestamp)[source]#
If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event.