跳到主要内容

HeapProfiler🧪

✅️️ Methods

🔨HeapProfiler.addInspectedHeapObject

启用控制台通过$x引用具有给定ID的节点(有关$x函数的更多详细信息,请参阅命令行API)。

EN
Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions).
参数必填标记类型描述原文
heapObjectId✔️HeapSnapshotObjectId堆快照对象ID可通过$x命令行API访问。
ENHeap snapshot object id to be accessible by means of $x command line API.

🔨HeapProfiler.collectGarbage


🔨HeapProfiler.disable


🔨HeapProfiler.enable


🔨HeapProfiler.getHeapObjectId

参数必填标记类型描述原文
objectId✔️Runtime.RemoteObjectId获取堆对象ID的目标对象标识符。
ENIdentifier of the object to get heap object id for.
返回对象类型描述原文
heapSnapshotObjectIdHeapSnapshotObjectId与传递的远程对象ID对应的堆快照对象的ID。
ENId of the heap snapshot object corresponding to the passed remote object id.

🔨HeapProfiler.getObjectByHeapObjectId

参数必填标记类型描述原文
objectId✔️HeapSnapshotObjectId
objectGroupstring可用于释放多个对象的符号组名称。
ENSymbolic group name that can be used to release multiple objects.
返回对象类型描述原文
resultRuntime.RemoteObject评估结果。
ENEvaluation result.

🔨HeapProfiler.getSamplingProfile

返回对象类型描述原文
profileSamplingHeapProfile返回正在收集的采样配置文件。
ENReturn the sampling profile being collected.

🔨HeapProfiler.startSampling

参数必填标记类型描述原文
samplingIntervalnumber平均采样间隔(以字节为单位)。间隔采用泊松分布。默认值为32768字节。
ENAverage sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes.
stackDepthnumber最大堆栈深度。默认值为128。
ENMaximum stack depth. The default value is 128.
includeObjectsCollectedByMajorGCboolean默认情况下,采样堆分析器仅报告通过getSamplingProfilestopSampling返回配置文件时仍然存活的对象,这有助于确定哪些函数对稳态内存使用贡献最大。此标志指示采样堆分析器同时包含被主GC丢弃的对象信息,这将显示哪些函数导致大量临时内存使用或较长的GC暂停。
ENBy 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.
includeObjectsCollectedByMinorGCboolean默认情况下,采样堆分析器仅报告通过getSamplingProfile或stopSampling返回配置文件时仍然存活的对象,这对于确定哪些函数对稳态内存使用贡献最大非常有用。此标志指示采样堆分析器同时包含被次要GC丢弃的对象信息,这在为延迟敏感型应用程序调优以最小化GC活动时非常有用。
ENBy 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.

🔨HeapProfiler.startTrackingHeapObjects

参数必填标记类型描述原文
trackAllocationsboolean

🔨HeapProfiler.stopSampling

返回对象类型描述原文
profileSamplingHeapProfile已记录采样堆分析。
ENRecorded sampling heap profile.

🔨HeapProfiler.stopTrackingHeapObjects

参数必填标记类型描述原文
reportProgressboolean如果为真,当跟踪停止时,在拍摄快照期间将生成'reportHeapSnapshotProgress'事件。
ENIf true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped.
treatGlobalObjectsAsRoots❌️boolean已弃用,推荐使用 exposeInternals
ENDeprecated in favor of exposeInternals.
captureNumericValueboolean如果为真,快照中将包含数值
ENIf true, numerical values are included in the snapshot
exposeInternals🧪boolean如果为真,则暴露快照的内部结构。
ENIf true, exposes internals of the snapshot.

🔨HeapProfiler.takeHeapSnapshot

参数必填标记类型描述原文
reportProgressboolean如果为真,则在拍摄快照时将生成'reportHeapSnapshotProgress'事件。
ENIf true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken.
treatGlobalObjectsAsRoots❌️boolean如果为真,将生成一个不含人工根节点的原始快照。已弃用,建议改用 exposeInternals
ENIf true, a raw snapshot without artificial roots will be generated. Deprecated in favor of exposeInternals.
captureNumericValueboolean如果为真,快照中将包含数值
ENIf true, numerical values are included in the snapshot
exposeInternals🧪boolean如果为真,则暴露快照的内部结构。
ENIf true, exposes internals of the snapshot.

✅️️ Events

👋HeapProfiler.addHeapSnapshotChunk

参数必填标记类型描述原文
chunk✔️string

👋HeapProfiler.heapStatsUpdate

如果堆对象跟踪已启动,则后端可能会发送一个或多个片段的更新

EN
If heap objects tracking has been started then backend may send update for one or more fragments
参数必填标记类型描述原文
statsUpdate✔️array[integer]一个三元组数组。每个三元组描述一个片段。第一个整数是片段索引,第二个整数是片段的对象总数,第三个整数是片段对象的总大小。
ENAn 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.

👋HeapProfiler.lastSeenObjectId

如果已启动堆对象跟踪,后端将定期发送最后一个看到的对象ID的当前值及其对应的时间戳。如果自上次事件以来堆中有变化,则在新的lastSeenObjectId事件之前会发送一个或多个heapStatsUpdate事件。

EN
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.
参数必填标记类型描述原文
lastSeenObjectId✔️integer
timestamp✔️number

👋HeapProfiler.reportHeapSnapshotProgress

参数必填标记类型描述原文
done✔️integer
total✔️integer
finishedboolean

👋HeapProfiler.resetProfiles


✅️️ Types

📌HeapProfiler.HeapSnapshotObjectId

堆快照对象ID。

EN
Heap snapshot object id.

返回类型:string


📌HeapProfiler.SamplingHeapProfile

采样配置文件。

EN
Sampling profile.

返回类型:object

属性必填标记类型描述原文
head✔️SamplingHeapProfileNode
samples✔️array[SamplingHeapProfileSample]

📌HeapProfiler.SamplingHeapProfileNode

采样堆分析节点。包含调用位置信息、分配统计数据和子节点。

EN
Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes.

返回类型:object

属性必填标记类型描述原文
callFrame✔️Runtime.CallFrame函数位置。
ENFunction location.
selfSize✔️number节点(不包括子节点)的内存分配大小(以字节为单位)。
ENAllocations size in bytes for the node excluding children.
id✔️integer节点ID。在startSamplingstopSampling之间收集的所有配置文件中,ID是唯一的。
ENNode id. Ids are unique across all profiles collected between startSampling and stopSampling.
children✔️array[SamplingHeapProfileNode]子节点。
ENChild nodes.

📌HeapProfiler.SamplingHeapProfileSample

采样配置文件中的单个样本。

EN
A single sample from a sampling profile.

返回类型:object

属性必填标记类型描述原文
size✔️number样本归因的分配大小(以字节为单位)。
ENAllocation size in bytes attributed to the sample.
nodeId✔️integer对应配置文件树节点的Id。
ENId of the corresponding profile tree node.
ordinal✔️number时间顺序样本序号。该序号在startSamplingstopSampling之间获取的所有配置文件中保持唯一。
ENTime-ordered sample ordinal number. It is unique across all profiles retrieved between startSampling and stopSampling.