Unity - Scripting API: HierarchyFrameDataView
class in UnityEditor.Profiling
/
Inherits from:Profiling.FrameDataView
Success!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Submission failed
For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Description
Provides access to the Profiler data for a specific frame and thread.
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.
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 Properties
| Property | 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. |
Inherited Members
Static Properties
| Property | Description |
|---|---|
| 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. |
Properties
| Property | Description |
|---|---|
| frameFps | The current frames per second (FPS) for the frame. |
| frameGpuTimeMs | The amount of GPU frame time in milliseconds. |
| 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 | The amount of CPU frame time in milliseconds. |
| 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 | The name of the group that the thread belongs to. |
| threadId | Persistent identifier associated with the thread. |
| threadIndex | The index of the thread in the current frame. |
| threadName | Name of the thread. |
| valid | True after the frame data for the thread is processed and ready for retrieval. |