Version: 2020.3
LanguageEnglish
  • C#

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

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.

Properties

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.

Public Methods

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.
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.
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.
GetItemMergedSamplesInstanceIDRetrieves the instanceID 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 ('/').
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.
SortSorts the hierarchy view.

Inherited Members

Static Properties

invalidMarkerIdIdentifier of the invalid marker.

Properties

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.

Public Methods

GetAllCategoriesGets all the available Profiler Categories for the current profiling session.
GetCategoryInfoGets the Profiler category information for a given category ID.
GetCounterValueAsDoubleGets the last value of a counter marker in the frame as a double data type'.
GetCounterValueAsFloatGets the last value of a counter marker in the frame as a float data type'.
GetCounterValueAsIntGets the last value of a counter marker in the frame as an int data type'.
GetCounterValueAsLongGets the last value of a counter marker in the frame as a long data type.
GetCounterValuePtrGets unsafe pointer to the last value of a counter marker in the frame.
GetFrameMetaDataRetrieves metadata associated with the frame.
GetFrameMetaDataCountGets the total number of metadata chunks for each id and tag pair in the frame.
GetMarkerCategoryIndexGets Profiler marker category for the specific marker identifier.
GetMarkerFlagsGets Profiler marker flags for the specific marker identifier.
GetMarkerIdGet Profiler marker identifier for a specific name.
GetMarkerMetadataInfoGets Profiler marker metadata information for the specific marker identifier.
GetMarkerNameGets Profiler marker name for the specific marker identifier.
GetMarkersGets all available markers for the current profiling session.
GetSessionMetaDataRetrieves the metadata of the session this frame occurred in as a NativeArray.
GetSessionMetaDataCountGets the total number of metadata chunks for each id and tag pair in the Profiler session.
HasCounterValueReturns true for a marker that includes a counter in the active frame.
ResolveMethodInfoReturns method name and location information for the specified method address.