提供对特定帧和线程的性能分析器数据的访问。
        使用 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 | 指示是否禁用排序的列标识符。 | 
| columnGcMemory | GC 分配列。 | 
| columnName | 性能分析器样本名称列。 | 
| columnObjectName | 对象名称列。 | 
| columnSelfPercent | CPU 在调用本身中花费的时间百分比。 | 
| columnSelfTime | CPU 在调用本身中花费的时间量。该时间量以毫秒为单位进行表示。 | 
| columnStartTime | 调用的开始时间(以毫秒为单位)。 | 
| columnTotalPercent | CPU 在调用层级中花费的时间百分比。 | 
| columnTotalTime | CPU 在调用层级中花费的时间量。该时间量以毫秒为单位进行表示。 | 
| columnWarningCount | 对于性能是次优的代码执行路径中的样本量。 | 
| invalidSampleId | 无效项的索引。 | 
| sortColumn | 定义排序列的列标识符。 | 
| sortColumnAscending | 排序顺序是升序 (true) 还是降序 (false)。 | 
| viewMode | 定义如何汇总数据的视图模式。 | 
| GetItemAncestors | 获取层级视图项祖先的列表。 | 
| GetItemCallstack | 获取与指定层级视图项关联的调用栈。 | 
| GetItemCategoryIndex | Gets Profiler marker category for the specific marker identifier. | 
| GetItemChildren | 获取层级视图项的子项的列表。 | 
| GetItemColumnData | 返回与列关联的层级视图项值的字符串表示形式。 | 
| GetItemColumnDataAsDouble | 返回与列关联的层级视图项值的双精度值表示形式。 | 
| GetItemColumnDataAsFloat | 返回与列关联的层级视图项值的浮点值表示形式。 | 
| GetItemColumnDataAsSingle | 返回与列关联的层级视图项值的浮点值表示形式。 | 
| GetItemDepth | 返回项的层级视图级别。 | 
| GetItemDescendantsThatHaveChildren | 用于获取具有其他子项的层级视图项后代的列表。 | 
| GetItemInstanceID | 返回与样本关联的 UnityEngine.Object 的 InstanceID。 | 
| GetItemMarkerFlags | 用于获取标记的用途标志。 | 
| GetItemMarkerID | 返回唯一标识样本名称的性能分析器标记。 | 
| GetItemMarkerIDPath | 用于获取所有层级视图项父项的标记的标识符列表。 | 
| GetItemMergedSampleCallstack | 获取与指定层级视图项关联的调用栈。 | 
| GetItemMergedSamplesColumnData | 用于获取层级视图项的合并样本的值。 | 
| GetItemMergedSamplesColumnDataAsDoubles | Retrieves 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 | 获取字符串形式的层级视图项路径。每个级别由正斜杠(“/”)分隔。 | 
| GetItemRawFrameDataViewIndices | Retrieves the raw indices of all samples associated with this Hierarchy item identifier. | 
| GetRootItemID | 获取根树项的标识符。 | 
| HasItemChildren | 检查树项是否具有子项。 | 
| ItemContainsRawFrameDataViewIndex | Checks if the provided raw sample index matches any of the raw sample indices associated with this Hierarchy item identifier. | 
| ResolveItemCallstack | 获取与指定层级视图项关联的调用栈。 | 
| ResolveItemMergedSampleCallstack | 获取与特定项样本关联的调用栈。 | 
| Sort | 对层级视图排序。 | 
| invalidMarkerId | Identifier of the invalid marker. | 
| invalidThreadId | This constant defines a thread id that does not match any valid thread's id. | 
| invalidThreadIndex | This constant defines a thread index that does not match any valid thread's index. | 
| frameFps | The current frames per second (FPS) for the frame. | 
| frameGpuTimeMs | GPU 帧时间量(以毫秒为单位)。 | 
| frameGpuTimeNs | The amount of GPU frame time in nanoseconds. | 
| frameIndex | The frame index for the FrameDataView. | 
| frameStartTimeMs | The start time of CPU frame in milliseconds. | 
| frameStartTimeNs | The start time of CPU frame in nanoseconds. | 
| frameTimeMs | CPU 帧时间量(以毫秒为单位)。 | 
| frameTimeNs | The amount of CPU frame time in nanoseconds. | 
| maxDepth | Maximum child samples levels in the thread data. | 
| sampleCount | The amount of samples in the frame for the thread. | 
| threadGroupName | 线程所属的组的名称。 | 
| threadId | 与线程关联的持久标识符。 | 
| threadIndex | 当前帧中的线程的索引。 | 
| threadName | 线程的名称。 | 
| valid | 在线程的帧数据已经过处理并准备好进行获取之后,为 True。 | 
| GetAllCategories | Gets all the available Profiler Categories for the current profiling session. | 
| GetCategoryInfo | Gets the Profiler category information for a given category ID. | 
| GetCounterValueAsDouble | Gets the last value of a counter marker in the frame as a double data type'. | 
| GetCounterValueAsFloat | Gets the last value of a counter marker in the frame as a float data type'. | 
| GetCounterValueAsInt | Gets the last value of a counter marker in the frame as an int data type'. | 
| GetCounterValueAsLong | Gets the last value of a counter marker in the frame as a long data type. | 
| GetCounterValuePtr | Gets unsafe pointer to the last value of a counter marker in the frame. | 
| GetFrameMetaData | 获取与帧关联的元数据。 | 
| GetFrameMetaDataCount | 获取帧中每个 ID 和标签 对的元数据块总数。 | 
| GetGfxResourceInfo | Gets information for a given graphics resource identifier. | 
| GetMarkerCategoryIndex | Gets Profiler marker category for the specific marker identifier. | 
| GetMarkerFlags | Gets Profiler marker flags for the specific marker identifier. | 
| GetMarkerId | Get Profiler marker identifier for a specific name. | 
| GetMarkerMetadataInfo | Gets Profiler marker metadata information for the specific marker identifier. | 
| GetMarkerName | Gets Profiler marker name for the specific marker identifier. | 
| GetMarkers | Gets all available markers for the current profiling session. | 
| GetSessionMetaData | Retrieves the metadata of the session this frame occurred in as a NativeArray. | 
| GetSessionMetaDataCount | Gets the total number of metadata chunks for each id and tag pair in the Profiler session. | 
| GetUnityObjectInfo | Gets the UnityEngine.Object information for a given Instance ID. | 
| GetUnityObjectNativeTypeInfo | Gets native Unity type intormation. | 
| GetUnityObjectNativeTypeInfoCount | Returns native types count in the capture. | 
| HasCounterValue | Returns true for a marker that includes a counter in the active frame. | 
| ResolveMethodInfo | 返回指定方法地址的方法名称和位置信息。 |