Version: 2019.2
LanguageEnglish
  • C#

HierarchyFrameDataView

class in UnityEditor.Profiling

/

Implemented in:UnityEditor

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

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 Methods

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.
GetItemChildrenRetrieves a list of hierarchy item children.
GetItemColumnDataReturns string 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.
GetItemMarkerIDReturns Profiler marker which uniquely identifies sample name.
GetItemMarkerIDPathUse to retrieve a list of a marker identifiers of all hierarchy item parents.
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.
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.