class in UnityEditor.Profiling
/
Inherits from:Profiling.FrameDataView
/
Implemented in:UnityEditor
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; } }
See Also: FrameDataView, HierarchyFrameDataView.
GetFlowEvents | Gets all flow events for the current frame and thread. |
GetSampleCallstack | Gets the callstack associated with the specified sample. |
GetSampleCategoryIndex | Gets Profiler marker category for the specific sample. |
GetSampleChildrenCount | Gets amount of child samples for the specific sample. |
GetSampleChildrenCountRecursive | Gets amount of direct and indirect child samples for the specific sample. |
GetSampleFlags | Gets Profiler marker flags for the specific sample. |
GetSampleFlowEvents | Gets flow events which are originating from the specific sample. |
GetSampleMarkerId | Gets Profiler marker indentifier which uniquely identifies sample name. |
GetSampleMetadataAsDouble | Gets sample metadata value as double. |
GetSampleMetadataAsFloat | Gets sample metadata value as float. |
GetSampleMetadataAsInt | Gets sample metadata value as integer. |
GetSampleMetadataAsLong | Gets sample metadata value as long. |
GetSampleMetadataAsString | Gets sample metadata value as string. |
GetSampleMetadataCount | Gets metadata count associated with the specific sample. |
GetSampleName | Gets the name of the specific sample. |
GetSampleStartTimeMs | Gets the start time of the sample. The amount of time is expressed in milliseconds. |
GetSampleStartTimeNs | Gets the start time of the sample. The amount of time is expressed in nanoseconds. |
GetSampleTimeMs | Gets the duration of sample. The amount of time is expressed in milliseconds. |
GetSampleTimeNs | Gets the duration of sample. The amount of time is expressed in nanoseconds. |
invalidMarkerId | Identifier of the invalid marker. |
frameFps | The current frames per second (FPS) for the frame. |
frameGpuTimeMs | The amount of GPU frame time in milliseconds. |
frameGpuTimeNs | The amount of GPU frame time in nanoseconds. |
frameIndex | The frame index for the FrameDataView. |
frameStartTimeMs | The start time of CPU frame in milliseconds. |
frameStartTimeNs | The start time of CPU frame in nanoseconds. |
frameTimeMs | The amount of CPU frame time in milliseconds. |
frameTimeNs | The amount of CPU frame time in nanoseconds. |
maxDepth | Maximum child samples levels in the thread data. |
sampleCount | The amount of samples in the frame for the thread. |
threadGroupName | The name of the group that the thread belongs to. |
threadId | Persistent identifier associated with the thread. |
threadIndex | The index of the thread in the current frame. |
threadName | Name of the thread. |
valid | True after the frame data for the thread is processed and ready for retrieval. |
GetCounterValueAsDouble | Gets the last value of a counter marker in the frame as a double data type'. |
GetCounterValueAsFloat | Gets the last value of a counter marker in the frame as a float data type'. |
GetCounterValueAsInt | Gets the last value of a counter marker in the frame as an int data type'. |
GetCounterValueAsLong | Gets the last value of a counter marker in the frame as a long data type. |
GetCounterValuePtr | Gets unsafe pointer to the last value of a counter marker in the frame. |
GetFrameMetaData | Retrieves metadata associated with the frame. |
GetFrameMetaDataCount | Gets the total number of metadata chunks for each id and tag pair in the frame. |
GetMarkerCategoryIndex | Gets Profiler marker category for the specific marker identifier. |
GetMarkerFlags | Gets Profiler marker flags for the specific marker identifier. |
GetMarkerId | Get Profiler marker identifier for a specific name. |
GetMarkerName | Gets Profiler marker name for the specific marker identifier. |
GetMarkers | Gets all available markers for the current profiling session. |
HasCounterValue | Returns true for a marker that includes a counter in the active frame. |
ResolveMethodInfo | Returns method name and location information for the specified method address. |