Version: 2021.3

HierarchyFrameDataView

class in UnityEditor.Profiling

/

继承自:Profiling.FrameDataView

切换到手册

描述

提供对特定帧和线程的性能分析器数据的访问。

使用 HierarchyFrameDataView 可获取结构为层级视图的性能分析器样本。
例如,这可用于 CPU 使用率性能分析器Hierachy mode

HierarchyFrameDataView 通过时间和内存信息汇总数据。每个层级视图项都包含其子项的累积数据。

using System;
using System.Collections.Generic;
using UnityEditor.Profiling;
using UnityEditorInternal;

public class Example { List<int> parentsCacheList = new List<int>(); List<int> childrenCacheList = new List<int>();

public void ProcessFrameData(int frame) { using (var frameData = ProfilerDriver.GetHierarchyFrameDataView(frame, 0, HierarchyFrameDataView.ViewModes.Default, HierarchyFrameDataView.columnGcMemory, false)) { int rootId = frameData.GetRootItemID(); frameData.GetItemDescendantsThatHaveChildren(rootId, parentsCacheList); foreach (int parentId in parentsCacheList) { frameData.GetItemChildren(parentId, childrenCacheList); // Process further records } } } }

静态变量

columnCalls调用列。
columnDontSort指示是否禁用排序的列标识符。
columnGcMemoryGC 分配列。
columnName性能分析器样本名称列。
columnObjectName对象名称列。
columnSelfPercentCPU 在调用本身中花费的时间百分比。
columnSelfTimeCPU 在调用本身中花费的时间量。该时间量以毫秒为单位进行表示。
columnStartTime调用的开始时间(以毫秒为单位)。
columnTotalPercentCPU 在调用层级中花费的时间百分比。
columnTotalTimeCPU 在调用层级中花费的时间量。该时间量以毫秒为单位进行表示。
columnWarningCount对于性能是次优的代码执行路径中的样本量。
invalidSampleId无效项的索引。

变量

sortColumn定义排序列的列标识符。
sortColumnAscending排序顺序是升序 (true) 还是降序 (false)。
viewMode定义如何汇总数据的视图模式。

公共函数

GetItemAncestors获取层级视图项祖先的列表。
GetItemCallstack获取与指定层级视图项关联的调用栈。
GetItemCategoryIndexGets Profiler marker category for the specific marker identifier.
GetItemChildren获取层级视图项的子项的列表。
GetItemColumnData返回与列关联的层级视图项值的字符串表示形式。
GetItemColumnDataAsDouble返回与列关联的层级视图项值的双精度值表示形式。
GetItemColumnDataAsFloat返回与列关联的层级视图项值的浮点值表示形式。
GetItemColumnDataAsSingle返回与列关联的层级视图项值的浮点值表示形式。
GetItemDepth返回项的层级视图级别。
GetItemDescendantsThatHaveChildren用于获取具有其他子项的层级视图项后代的列表。
GetItemInstanceID返回与样本关联的 UnityEngine.Object 的 InstanceID。
GetItemMarkerFlags用于获取标记的用途标志。
GetItemMarkerID返回唯一标识样本名称的性能分析器标记。
GetItemMarkerIDPath用于获取所有层级视图项父项的标记的标识符列表。
GetItemMergedSampleCallstack获取与指定层级视图项关联的调用栈。
GetItemMergedSamplesColumnData用于获取层级视图项的合并样本的值。
GetItemMergedSamplesColumnDataAsDoublesRetrieves the merged samples for a specific hierarchy item. Merged samples are returned as a list of doubles through the outValues param.
GetItemMergedSamplesColumnDataAsFloats获取特定层级视图项的合并样本。合并样本通过 outValues 参数,作为浮点值列表返回。
GetItemMergedSamplesCount返回层级视图项所表示的合并样本数量。
GetItemMergedSamplesInstanceID获取与层级视图项对应的合并样本的 instanceID。
GetItemMergedSamplesMetadata返回层级视图项元数据值的字符串表示形式。
GetItemMergedSamplesMetadataAsFloat返回层级视图项元数据值的浮点值表示形式。
GetItemMergedSamplesMetadataAsLong返回层级视图项元数据值的长整型表示形式。
GetItemMergedSamplesMetadataCount返回与层级视图项关联的元数据数量。
GetItemMetadata返回层级视图项元数据值的字符串表示形式。
GetItemMetadataAsFloat返回层级视图项元数据值的浮点值表示形式。
GetItemMetadataAsLong返回层级视图项元数据值的长整型表示形式。
GetItemMetadataCount返回与层级视图项关联的元数据数量。
GetItemName获取与项关联的样本名称。
GetItemPath获取字符串形式的层级视图项路径。每个级别由正斜杠(“/”)分隔。
GetItemRawFrameDataViewIndicesRetrieves the raw indices of all samples associated with this Hierarchy item identifier.
GetRootItemID获取根树项的标识符。
HasItemChildren检查树项是否具有子项。
ItemContainsRawFrameDataViewIndexChecks if the provided raw sample index matches any of the raw sample indices associated with this Hierarchy item identifier.
ResolveItemCallstack获取与指定层级视图项关联的调用栈。
ResolveItemMergedSampleCallstack获取与特定项样本关联的调用栈。
Sort对层级视图排序。

继承的成员

静态变量

invalidMarkerIdIdentifier of the invalid marker.
invalidThreadIdThis constant defines a thread id that does not match any valid thread's id.
invalidThreadIndexThis constant defines a thread index that does not match any valid thread's index.

变量

frameFpsThe current frames per second (FPS) for the frame.
frameGpuTimeMsGPU 帧时间量(以毫秒为单位)。
frameGpuTimeNsThe amount of GPU frame time in nanoseconds.
frameIndexThe frame index for the FrameDataView.
frameStartTimeMsThe start time of CPU frame in milliseconds.
frameStartTimeNsThe start time of CPU frame in nanoseconds.
frameTimeMsCPU 帧时间量(以毫秒为单位)。
frameTimeNsThe amount of CPU frame time in nanoseconds.
maxDepthMaximum child samples levels in the thread data.
sampleCountThe amount of samples in the frame for the thread.
threadGroupName线程所属的组的名称。
threadId与线程关联的持久标识符。
threadIndex当前帧中的线程的索引。
threadName线程的名称。
valid在线程的帧数据已经过处理并准备好进行获取之后,为 True。

公共函数

GetAllCategoriesGets all the available Profiler Categories for the current profiling session.
GetCategoryInfoGets the Profiler category information for a given category ID.
GetCounterValueAsDoubleGets the last value of a counter marker in the frame as a double data type'.
GetCounterValueAsFloatGets the last value of a counter marker in the frame as a float data type'.
GetCounterValueAsIntGets the last value of a counter marker in the frame as an int data type'.
GetCounterValueAsLongGets the last value of a counter marker in the frame as a long data type.
GetCounterValuePtrGets unsafe pointer to the last value of a counter marker in the frame.
GetFrameMetaData获取与帧关联的元数据。
GetFrameMetaDataCount获取帧中每个 ID 和标签 对的元数据块总数。
GetMarkerCategoryIndexGets Profiler marker category for the specific marker identifier.
GetMarkerFlagsGets Profiler marker flags for the specific marker identifier.
GetMarkerIdGet Profiler marker identifier for a specific name.
GetMarkerMetadataInfoGets Profiler marker metadata information for the specific marker identifier.
GetMarkerNameGets Profiler marker name for the specific marker identifier.
GetMarkersGets all available markers for the current profiling session.
GetSessionMetaDataRetrieves the metadata of the session this frame occurred in as a NativeArray.
GetSessionMetaDataCountGets the total number of metadata chunks for each id and tag pair in the Profiler session.
HasCounterValueReturns true for a marker that includes a counter in the active frame.
ResolveMethodInfo返回指定方法地址的方法名称和位置信息。