Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


HierarchyFrameDataView

Provides access to the Profiler data for a specific frame and thread.
Read time 6 minutesLast updated 11 days ago

Definition

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

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.

Methods

Method

Description

GetItemAncestorsRetrieves a list of hierarchy item ancestors.
GetItemCallstackGets the callstack associated with the specified hierarchy item.
GetItemCategoryIndexGets Profiler marker category for the specific marker identifier.
GetItemChildrenRetrieves a list of hierarchy item children.
GetItemColumnDataReturns string representation of hierarchy item value associated with the column.
GetItemColumnDataAsDoubleReturns double representation of hierarchy item value associated with the column.
GetItemColumnDataAsFloatReturns float representation of hierarchy item value associated with the column.
GetItemColumnDataAsSingleReturns float representation of hierarchy item value associated with the column.
GetItemDepthReturns hierarchy level of the item.
GetItemDescendantsThatHaveChildrenUse to retrieve a list of a hierarchy item descendants which have other children.
GetItemEntityIdReturns EntityId of the UnityEngine.Object associated with the sample.
GetItemMarkerFlagsUse to retrieve a marker usage flags.
GetItemMarkerIDReturns Profiler marker which uniquely identifies sample name.
GetItemMarkerIDPathUse to retrieve a list of a marker identifiers of all hierarchy item parents.
GetItemMergedSampleCallstackGets the callstack associated with the specified hierarchy item.
GetItemMergedSamplesColumnDataUse to retrieve a values of merged samples of a hierarchy item.
GetItemMergedSamplesColumnDataAsDoublesRetrieves the merged samples for a specific hierarchy item. Merged samples are returned as a list of doubles through the outValues param.
GetItemMergedSamplesColumnDataAsFloatsRetrieves the merged samples for a specific hierarchy item. Merged samples are returned as a list of floats through the outValues param.
GetItemMergedSamplesCountReturn merged samples count represented by the hierarchy item.
GetItemMergedSamplesEntityIdRetrieves the EntityId of the merged samples corresponding to a hierarchy item.
GetItemMergedSamplesMetadataReturns string representation of hierarchy item metadata value.
GetItemMergedSamplesMetadataAsFloatReturns float representation of hierarchy item metadata value.
GetItemMergedSamplesMetadataAsLongReturns long representation of hierarchy item metadata value.
GetItemMergedSamplesMetadataCountReturns metadata count associated with hierarchy item.
GetItemMetadataReturns string representation of hierarchy item metadata value.
GetItemMetadataAsFloatReturns float representation of hierarchy item metadata value.
GetItemMetadataAsLongReturns long representation of hierarchy item metadata value.
GetItemMetadataCountReturns metadata count associated with hierarchy item.
GetItemNameGets the sample name associated with the item.
GetItemPathRetrieves the hierarchy item path as a string. Each level is delimited by forward slashes ('/').
GetItemRawFrameDataViewIndicesRetrieves the raw indices of all samples associated with this Hierarchy item identifier.
GetRootItemIDGets the identifier for the root tree item.
HasItemChildrenChecks whether the tree item has children.
ItemContainsRawFrameDataViewIndexChecks if the provided raw sample index matches any of the raw sample indices associated with this Hierarchy item identifier.
ResolveItemCallstackGets the callstack associated with the specified hierarchy item.
ResolveItemMergedSampleCallstackGets the callstack associated with a specific item sample.
SortSorts the hierarchy view.

Enums

Enum

Description

HierarchyFrameDataView.ViewModesThe ViewModes enum defines data aggregation rules.

Inheritance

Inherited Members