Version: 2022.3
LanguageEnglish
  • C#

RawFrameDataView

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 RawFrameDataView to retrieve unstructured Profiler samples data for the particular frame.
The order of samples is determined by the order they are generated in the code.

RawFrameDataView can quickly iterate over all samples in the frame without any internal allocations.

using System;
using Unity.Collections;
using UnityEditor.Profiling;
using UnityEditorInternal;
using UnityEngine;
using UnityEngine.Profiling;

public class Example { public static long GetGCAllocs(int frameIndex) { long totalGcAllocSize = 0;

int gcAllocMarkerId = FrameDataView.invalidMarkerId;

for (int threadIndex = 0;; ++threadIndex) { using (RawFrameDataView frameData = ProfilerDriver.GetRawFrameDataView(frameIndex, threadIndex)) { if (!frameData.valid) break;

if (gcAllocMarkerId == FrameDataView.invalidMarkerId) { gcAllocMarkerId = frameData.GetMarkerId("GC.Alloc"); if (gcAllocMarkerId == FrameDataView.invalidMarkerId) break; }

int sampleCount = frameData.sampleCount; for (int i = 0; i < sampleCount; ++i) { if (gcAllocMarkerId != frameData.GetSampleMarkerId(i)) continue;

long gcAllocSize = frameData.GetSampleMetadataAsLong(i, 0); totalGcAllocSize += gcAllocSize; } } }

return totalGcAllocSize; } }

Additional resources: FrameDataView, HierarchyFrameDataView.

Static Properties

invalidSampleIndexThis constant defines a sample index that does not match any valid Profiler Sample.

Public Methods

GetFlowEventsGets all flow events for the current frame and thread.
GetSampleCallstackGets the callstack associated with the specified sample.
GetSampleCategoryIndexGets Profiler marker category for the specific sample.
GetSampleChildrenCountGets amount of child samples for the specific sample.
GetSampleChildrenCountRecursiveGets amount of direct and indirect child samples for the specific sample.
GetSampleFlagsGets Profiler marker flags for the specific sample.
GetSampleFlowEventsGets the flow events that originate from the specific sample.
GetSampleMarkerIdGets Profiler marker indentifier which uniquely identifies sample name.
GetSampleMetadataAsDoubleGets sample metadata value as double.
GetSampleMetadataAsFloatGets sample metadata value as float.
GetSampleMetadataAsIntGets sample metadata value as integer.
GetSampleMetadataAsLongGets sample metadata value as long.
GetSampleMetadataAsSpanReturns Span<T> representation of sample metadata.
GetSampleMetadataAsStringGets sample metadata value as string.
GetSampleMetadataCountGets metadata count associated with the specific sample.
GetSampleNameGets the name of the specific sample.
GetSampleStartTimeMsGets the start time of the sample. The amount of time is expressed in milliseconds.
GetSampleStartTimeNsGets the start time of the sample. The amount of time is expressed in nanoseconds.
GetSampleTimeMsGets the duration of sample. The amount of time is expressed in milliseconds.
GetSampleTimeNsGets the duration of sample. The amount of time is expressed in nanoseconds.

Inherited Members

Static Properties

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

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.
GetGfxResourceInfoGets information for a given graphics resource identifier.
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.
GetUnityObjectInfoGets the UnityEngine.Object information for a given Instance ID.
GetUnityObjectNativeTypeInfoGets native Unity type intormation.
GetUnityObjectNativeTypeInfoCountReturns native types count in the capture.
HasCounterValueReturns true for a marker that includes a counter in the active frame.
ResolveMethodInfoReturns method name and location information for the specified method address.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961