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
cdp.heap_profiler.
HeapSnapshotObjectId
¶ Heap snapshot object id.
-
class
cdp.heap_profiler.
SamplingHeapProfileNode
(call_frame, self_size, id_, children)¶ Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes.
-
call_frame
= None¶ Function location.
-
children
= None¶ Child nodes.
-
id_
= None¶ Node id. Ids are unique across all profiles collected between startSampling and stopSampling.
-
self_size
= None¶ Allocations size in bytes for the node excluding children.
-
-
class
cdp.heap_profiler.
SamplingHeapProfileSample
(size, node_id, ordinal)¶ A single sample from a sampling profile.
-
node_id
= None¶ Id of the corresponding profile tree node.
-
ordinal
= None¶ Time-ordered sample ordinal number. It is unique across all profiles retrieved between startSampling and stopSampling.
-
size
= None¶ Allocation size in bytes attributed to the sample.
-
-
class
cdp.heap_profiler.
SamplingHeapProfile
(head, samples)¶ Sampling profile.
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.
-
cdp.heap_profiler.
add_inspected_heap_object
(heap_object_id)¶ Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions).
Parameters: heap_object_id ( HeapSnapshotObjectId
) – Heap snapshot object id to be accessible by means of $x command line API.Return type: Generator
[Dict
[str
,Any
],Dict
[str
,Any
],None
]
-
cdp.heap_profiler.
collect_garbage
()¶ Return type: Generator
[Dict
[str
,Any
],Dict
[str
,Any
],None
]
-
cdp.heap_profiler.
disable
()¶ Return type: Generator
[Dict
[str
,Any
],Dict
[str
,Any
],None
]
-
cdp.heap_profiler.
enable
()¶ Return type: Generator
[Dict
[str
,Any
],Dict
[str
,Any
],None
]
-
cdp.heap_profiler.
get_heap_object_id
(object_id)¶ 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.
-
cdp.heap_profiler.
get_object_by_heap_object_id
(object_id, object_group=None)¶ Parameters: - object_id (
HeapSnapshotObjectId
) – - object_group (
Optional
[str
]) – (Optional) Symbolic group name that can be used to release multiple objects.
Return type: Generator
[Dict
[str
,Any
],Dict
[str
,Any
],RemoteObject
]Returns: Evaluation result.
- object_id (
-
cdp.heap_profiler.
get_sampling_profile
()¶ Return type: Generator
[Dict
[str
,Any
],Dict
[str
,Any
],SamplingHeapProfile
]Returns: Return the sampling profile being collected.
-
cdp.heap_profiler.
start_sampling
(sampling_interval=None)¶ Parameters: sampling_interval ( Optional
[float
]) – (Optional) Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes.Return type: Generator
[Dict
[str
,Any
],Dict
[str
,Any
],None
]
-
cdp.heap_profiler.
start_tracking_heap_objects
(track_allocations=None)¶ Parameters: track_allocations ( Optional
[bool
]) – (Optional)Return type: Generator
[Dict
[str
,Any
],Dict
[str
,Any
],None
]
-
cdp.heap_profiler.
stop_sampling
()¶ Return type: Generator
[Dict
[str
,Any
],Dict
[str
,Any
],SamplingHeapProfile
]Returns: Recorded sampling heap profile.
-
cdp.heap_profiler.
stop_tracking_heap_objects
(report_progress=None)¶ Parameters: report_progress ( Optional
[bool
]) – (Optional) If true ‘reportHeapSnapshotProgress’ events will be generated while snapshot is being taken when the tracking is stopped.Return type: Generator
[Dict
[str
,Any
],Dict
[str
,Any
],None
]
-
cdp.heap_profiler.
take_heap_snapshot
(report_progress=None)¶ Parameters: report_progress ( Optional
[bool
]) – (Optional) If true ‘reportHeapSnapshotProgress’ events will be generated while snapshot is being taken.Return type: Generator
[Dict
[str
,Any
],Dict
[str
,Any
],None
]
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
cdp.heap_profiler.
AddHeapSnapshotChunk
(chunk)¶
-
class
cdp.heap_profiler.
HeapStatsUpdate
(stats_update)¶ If heap objects tracking has been started then backend may send update for one or more fragments
-
stats_update
= None¶ An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment.
-
-
class
cdp.heap_profiler.
LastSeenObjectId
(last_seen_object_id, timestamp)¶ 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.
-
class
cdp.heap_profiler.
ReportHeapSnapshotProgress
(done, total, finished)¶
-
class
cdp.heap_profiler.
ResetProfiles
¶