HierarchyFrameDataView
Provides access to the Profiler data for a specific frame and thread.
Read time 6 minutesLast updated 11 days ago
Definition
- Type: Class
- Namespace: UnityEditor.Profiling
- Assembly: UnityEditor.CoreModule
- Inherits from: FrameDataView
- Implements: IDisposable
public class HierarchyFrameDataView : FrameDataView, IDisposable
Remarks
Use HierarchyFrameDataView to retrieve Profiler samples structured as a hierarchy.
This is used in the Hierachy mode of the CPU Usage Profiler, for example.
The HierarchyFrameDataView aggregates the data with time and memory information. Each hierarchy item includes accumulated data of its children.
Examples
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 } } }}
Static Fields
Value | Description |
|---|---|
| columnCalls | The Calls column. |
| columnDontSort | The column identifier that indicates whether sorting is disabled. |
| columnGcMemory | The amount of managed allocations within a sample. |
| columnName | The Profiler Sample Name column. |
| columnObjectName | The Object Name column. |
| columnSelfPercent | The percentage of the CPU time Unity spends in a sample itself, excluding the time from child samples. |
| columnSelfTime | The CPU time in milliseconds that Unity spends in a sample itself, excluding the time from child samples. |
| columnStartTime | The start time of a call in milliseconds. |
| columnTotalPercent | The percentage of the CPU time Unity spends in a sample, including the time from child samples. |
| columnTotalTime | The CPU time in milliseconds that Unity spends in a sample, including the time from child samples. |
| columnWarningCount | The amount of samples that are inside a code execution path that is suboptimal for performance. |
| invalidSampleId | Index of the invalid item. |
Properties
Property | Description |
|---|---|
| sortColumn | The column identifier that defines the sort column. |
| sortColumnAscending | Whether the sorting order is ascending, true, or descending, false. |
| viewMode | The view mode which defines how data is aggregated. |
Methods
Method | Description |
|---|---|
| GetItemAncestors | Retrieves a list of hierarchy item ancestors. |
| GetItemCallstack | Gets the callstack associated with the specified hierarchy item. |
| GetItemCategoryIndex | Gets Profiler marker category for the specific marker identifier. |
| GetItemChildren | Retrieves a list of hierarchy item children. |
| GetItemColumnData | Returns string representation of hierarchy item value associated with the column. |
| GetItemColumnDataAsDouble | Returns double representation of hierarchy item value associated with the column. |
| GetItemColumnDataAsFloat | Returns float representation of hierarchy item value associated with the column. |
| GetItemColumnDataAsSingle | Returns float representation of hierarchy item value associated with the column. |
| GetItemDepth | Returns hierarchy level of the item. |
| GetItemDescendantsThatHaveChildren | Use to retrieve a list of a hierarchy item descendants which have other children. |
| GetItemEntityId | Returns EntityId of the UnityEngine.Object associated with the sample. |
| GetItemMarkerFlags | Use to retrieve a marker usage flags. |
| GetItemMarkerID | Returns Profiler marker which uniquely identifies sample name. |
| GetItemMarkerIDPath | Use to retrieve a list of a marker identifiers of all hierarchy item parents. |
| GetItemMergedSampleCallstack | Gets the callstack associated with the specified hierarchy item. |
| GetItemMergedSamplesColumnData | Use to retrieve a values of merged samples of a hierarchy item. |
| GetItemMergedSamplesColumnDataAsDoubles | Retrieves the merged samples for a specific hierarchy item. Merged samples are returned as a list of doubles through the outValues param. |
| GetItemMergedSamplesColumnDataAsFloats | Retrieves the merged samples for a specific hierarchy item. Merged samples are returned as a list of floats through the outValues param. |
| GetItemMergedSamplesCount | Return merged samples count represented by the hierarchy item. |
| GetItemMergedSamplesEntityId | Retrieves the EntityId of the merged samples corresponding to a hierarchy item. |
| GetItemMergedSamplesMetadata | Returns string representation of hierarchy item metadata value. |
| GetItemMergedSamplesMetadataAsFloat | Returns float representation of hierarchy item metadata value. |
| GetItemMergedSamplesMetadataAsLong | Returns long representation of hierarchy item metadata value. |
| GetItemMergedSamplesMetadataCount | Returns metadata count associated with hierarchy item. |
| GetItemMetadata | Returns string representation of hierarchy item metadata value. |
| GetItemMetadataAsFloat | Returns float representation of hierarchy item metadata value. |
| GetItemMetadataAsLong | Returns long representation of hierarchy item metadata value. |
| GetItemMetadataCount | Returns metadata count associated with hierarchy item. |
| GetItemName | Gets the sample name associated with the item. |
| GetItemPath | Retrieves the hierarchy item path as a string. Each level is delimited by forward slashes ('/'). |
| GetItemRawFrameDataViewIndices | Retrieves the raw indices of all samples associated with this Hierarchy item identifier. |
| GetRootItemID | Gets the identifier for the root tree item. |
| HasItemChildren | Checks whether the tree item has children. |
| ItemContainsRawFrameDataViewIndex | Checks if the provided raw sample index matches any of the raw sample indices associated with this Hierarchy item identifier. |
| ResolveItemCallstack | Gets the callstack associated with the specified hierarchy item. |
| ResolveItemMergedSampleCallstack | Gets the callstack associated with a specific item sample. |
| Sort | Sorts the hierarchy view. |
Enums
Enum | Description |
|---|---|
| HierarchyFrameDataView.ViewModes | The ViewModes enum defines data aggregation rules. |