HierarchyFrameDataView

class in UnityEditor.Profiling

Switch to Manual

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 Variables

columnCallsThe Calls column.
columnDontSortThe column identifier that indicates whether sorting is disabled.
columnGcMemoryThe GC Allocation column.
columnNameThe Profiler Sample Name column.
columnObjectNameThe Object Name column.
columnSelfPercentThe percentage of the time CPU spends in a call itself.
columnSelfTimeThe amount of the time CPU spends in a call itself. The amount of time is expressed in milliseconds.
columnStartTimeThe start time of a call in milliseconds.
columnTotalPercentThe percentage of time the CPU spends in a call hierarchy.
columnTotalTimeThe amount of time the CPU spends in a call hierarchy. The amount of time is expressed in milliseconds.
columnWarningCountThe amount of samples that are inside a code execution path that is suboptimal for performance.
invalidSampleIdIndex of the invalid item.

Variables

frameFpsThe current frames per second (fps) for the frame.
frameGpuTimeMsThe amount of GPU frame time in milliseconds.
frameIndexThe frame index for the HierarchyFrameDataView.
frameTimeMsThe amount of CPU frame time in milliseconds.
sortColumnThe column identifier that defines the sort column.
sortColumnAscendingWhether the sorting order is ascending, true, or descending, false.
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.
viewModeThe view mode which defines how data is aggregated.

Public Functions

GetFrameMetaDataRetrieves metadata associated with the frame.
GetFrameMetaDataCountGets the total number of metadata chunks for each id and tag pair in the frame.
GetItemAncestorsRetrieves a list of hierarchy item ancestors.
GetItemCallstackGets the callstack associated with the specified hierarchy item.
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.
GetItemInstanceIDReturns InstanceID 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.
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.
GetItemMergedSamplesInstanceIDRetrieves the instanceID of the merged samples corresponding to a 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 ('/').
GetRootItemIDGets the identifier for the root tree item.
HasItemChildrenChecks whether the tree item has children.
ResolveItemCallstackGets the callstack associated with the specified hierarchy item.
ResolveItemMergedSampleCallstackGets the callstack associated with a specific item sample.
ResolveMethodInfoReturns method name and location information for the specified method address.
SortSorts the hierarchy view.