Unity - Scripting API: HierarchyFrameDataView

class in UnityEditor.Profiling

/

Inherits from:Profiling.FrameDataView

Suggest a change

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.

Close

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.

Close

Cancel

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
columnCallsThe Calls column.
columnDontSortThe column identifier that indicates whether sorting is disabled.
columnGcMemoryThe amount of managed allocations within a sample.
columnNameThe Profiler Sample Name column.
columnObjectNameThe Object Name column.
columnSelfPercentThe percentage of the CPU time Unity spends in a sample itself, excluding the time from child samples.
columnSelfTimeThe CPU time in milliseconds that Unity spends in a sample itself, excluding the time from child samples.
columnStartTimeThe start time of a call in milliseconds.
columnTotalPercentThe percentage of the CPU time Unity spends in a sample, including the time from child samples.
columnTotalTimeThe CPU time in milliseconds that Unity spends in a sample, including the time from child samples.
columnWarningCountThe amount of samples that are inside a code execution path that is suboptimal for performance.
invalidSampleIdIndex of the invalid item.

Properties

Property Description
sortColumnThe column identifier that defines the sort column.
sortColumnAscendingWhether the sorting order is ascending, true, or descending, false.
viewModeThe view mode which defines how data is aggregated.

Inherited Members

Static Properties

PropertyDescription
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.

Properties

PropertyDescription
frameFpsThe current frames per second (FPS) for the frame.
frameGpuTimeMsThe amount of GPU frame time in milliseconds.
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.
frameTimeMsThe amount of CPU frame time in milliseconds.
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.
threadGroupNameThe name of the group that the thread belongs to.
threadIdPersistent identifier associated with the thread.
threadIndexThe index of the thread in the current frame.
threadNameName of the thread.
validTrue after the frame data for the thread is processed and ready for retrieval.