# RawFrameDataView

> Provides access to the Profiler data for a specific frame and thread.

## Definition

* **Type:** Class
* **Namespace:** [UnityEditor.Profiling](/engine/6000.5/script-reference/unityeditor/profiling.md)
* **Assembly:** UnityEditor.CoreModule
* **Inherits from:** [FrameDataView](/engine/6000.5/script-reference/unityeditor/profiling/framedataview.md)
* **Implements:** [IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

```csharp
public class RawFrameDataView : FrameDataView, IDisposable
```

## Remarks

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.

```csharp
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](/engine/6000.5/script-reference/unityeditor/profiling/framedataview.md), [HierarchyFrameDataView](/engine/6000.5/script-reference/unityeditor/profiling/hierarchyframedataview.md).

## Static Fields

| Value                                                                                                              | Description                                                                         |
| ------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------- |
| [invalidSampleIndex](/engine/6000.5/script-reference/unityeditor/profiling/rawframedataview/invalidsampleindex.md) | This constant defines a sample index that does not match any valid Profiler Sample. |

## Methods

| Method                                                                                                                                       | Description                                                                         |
| -------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| [GetFlowEvents](/engine/6000.5/script-reference/unityeditor/profiling/rawframedataview/getflowevents.md)                                     | Gets all flow events for the current frame and thread.                              |
| [GetSampleCallstack](/engine/6000.5/script-reference/unityeditor/profiling/rawframedataview/getsamplecallstack.md)                           | Gets the callstack associated with the specified sample.                            |
| [GetSampleCategoryIndex](/engine/6000.5/script-reference/unityeditor/profiling/rawframedataview/getsamplecategoryindex.md)                   | Gets Profiler marker category for the specific sample.                              |
| [GetSampleChildrenCount](/engine/6000.5/script-reference/unityeditor/profiling/rawframedataview/getsamplechildrencount.md)                   | Gets amount of child samples for the specific sample.                               |
| [GetSampleChildrenCountRecursive](/engine/6000.5/script-reference/unityeditor/profiling/rawframedataview/getsamplechildrencountrecursive.md) | Gets amount of direct and indirect child samples for the specific sample.           |
| [GetSampleFlags](/engine/6000.5/script-reference/unityeditor/profiling/rawframedataview/getsampleflags.md)                                   | Gets Profiler marker flags for the specific sample.                                 |
| [GetSampleFlowEvents](/engine/6000.5/script-reference/unityeditor/profiling/rawframedataview/getsampleflowevents.md)                         | Gets the flow events that originate from the specific sample.                       |
| [GetSampleMarkerId](/engine/6000.5/script-reference/unityeditor/profiling/rawframedataview/getsamplemarkerid.md)                             | Gets Profiler marker indentifier which uniquely identifies sample name.             |
| [GetSampleMetadataAsDouble](/engine/6000.5/script-reference/unityeditor/profiling/rawframedataview/getsamplemetadataasdouble.md)             | Gets sample metadata value as double.                                               |
| [GetSampleMetadataAsFloat](/engine/6000.5/script-reference/unityeditor/profiling/rawframedataview/getsamplemetadataasfloat.md)               | Gets sample metadata value as float.                                                |
| [GetSampleMetadataAsInt](/engine/6000.5/script-reference/unityeditor/profiling/rawframedataview/getsamplemetadataasint.md)                   | Gets sample metadata value as integer.                                              |
| [GetSampleMetadataAsLong](/engine/6000.5/script-reference/unityeditor/profiling/rawframedataview/getsamplemetadataaslong.md)                 | Gets sample metadata value as long.                                                 |
| [GetSampleMetadataAsSpan](/engine/6000.5/script-reference/unityeditor/profiling/rawframedataview/getsamplemetadataasspan.md)                 | Returns Span\\\<T\\> representation of sample metadata.                             |
| [GetSampleMetadataAsString](/engine/6000.5/script-reference/unityeditor/profiling/rawframedataview/getsamplemetadataasstring.md)             | Gets sample metadata value as string.                                               |
| [GetSampleMetadataCount](/engine/6000.5/script-reference/unityeditor/profiling/rawframedataview/getsamplemetadatacount.md)                   | Gets metadata count associated with the specific sample.                            |
| [GetSampleName](/engine/6000.5/script-reference/unityeditor/profiling/rawframedataview/getsamplename.md)                                     | Gets the name of the specific sample.                                               |
| [GetSampleStartTimeMs](/engine/6000.5/script-reference/unityeditor/profiling/rawframedataview/getsamplestarttimems.md)                       | Gets the start time of the sample. The amount of time is expressed in milliseconds. |
| [GetSampleStartTimeNs](/engine/6000.5/script-reference/unityeditor/profiling/rawframedataview/getsamplestarttimens.md)                       | Gets the start time of the sample. The amount of time is expressed in nanoseconds.  |
| [GetSampleTimeMs](/engine/6000.5/script-reference/unityeditor/profiling/rawframedataview/getsampletimems.md)                                 | Gets the duration of sample. The amount of time is expressed in milliseconds.       |
| [GetSampleTimeNs](/engine/6000.5/script-reference/unityeditor/profiling/rawframedataview/getsampletimens.md)                                 | Gets the duration of sample. The amount of time is expressed in nanoseconds.        |

## Structs

| Struct                                                                                                            | Description                                                                               |
| ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| [RawFrameDataView.FlowEvent](/engine/6000.5/script-reference/unityeditor/profiling/rawframedataview/flowevent.md) | This struct describes profiler flow and its relation to the specific sample in the frame. |

## Inheritance

**Inherited Members:**

* [FrameDataView.invalidMarkerId](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/invalidmarkerid.md)
* [FrameDataView.invalidThreadIndex](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/invalidthreadindex.md)
* [FrameDataView.invalidThreadId](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/invalidthreadid.md)
* [FrameDataView.GetMarkerCategoryIndex(int)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getmarkercategoryindex.md)
* [FrameDataView.GetMarkerFlags(int)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getmarkerflags.md)
* [FrameDataView.GetMarkerName(int)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getmarkername.md)
* [FrameDataView.GetMarkerMetadataInfo(int)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getmarkermetadatainfo.md)
* [FrameDataView.GetMarkerId(string)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getmarkerid.md)
* [FrameDataView.GetMarkers(List\<MarkerInfo>)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getmarkers.md)
* [FrameDataView.GetCategoryInfo(ushort)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getcategoryinfo.md)
* [FrameDataView.GetAllCategories(List\<ProfilerCategoryInfo>)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getallcategories.md)
* [FrameDataView.GetFrameMetaData\<T>(Guid, int)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getframemetadata.md#getframemetadatat\(guid-int\))
* [FrameDataView.GetFrameMetaData\<T>(Guid, int, int)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getframemetadata.md#getframemetadatat\(guid-int-int\))
* [FrameDataView.GetFrameMetaDataCount(Guid, int)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getframemetadatacount.md)
* [FrameDataView.GetSessionMetaData\<T>(Guid, int)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getsessionmetadata.md#getsessionmetadatat\(guid-int\))
* [FrameDataView.GetSessionMetaData\<T>(Guid, int, int)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getsessionmetadata.md#getsessionmetadatat\(guid-int-int\))
* [FrameDataView.GetSessionMetaDataCount(Guid, int)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getsessionmetadatacount.md)
* [FrameDataView.ResolveMethodInfo(ulong)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/resolvemethodinfo.md)
* [FrameDataView.GetCounterValuePtr(int)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getcountervalueptr.md)
* [FrameDataView.HasCounterValue(int)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/hascountervalue.md)
* [FrameDataView.GetCounterValueAsInt(int)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getcountervalueasint.md)
* [FrameDataView.GetCounterValueAsLong(int)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getcountervalueaslong.md)
* [FrameDataView.GetCounterValueAsFloat(int)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getcountervalueasfloat.md)
* [FrameDataView.GetCounterValueAsDouble(int)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getcountervalueasdouble.md)
* [FrameDataView.GetUnityObjectInfo(EntityId, UnityObjectInfo)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getunityobjectinfo.md#getunityobjectinfo\(entityid-unityobjectinfo\))
* [FrameDataView.GetUnityObjectNativeTypeInfo(int, UnityObjectNativeTypeInfo)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getunityobjectnativetypeinfo.md)
* [FrameDataView.GetUnityObjectNativeTypeInfoCount()](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getunityobjectnativetypeinfocount.md)
* [FrameDataView.GetGfxResourceInfo(ulong, GfxResourceInfo)](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/getgfxresourceinfo.md)
* [FrameDataView.valid](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/valid.md)
* [FrameDataView.frameIndex](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/frameindex.md)
* [FrameDataView.threadIndex](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/threadindex.md)
* [FrameDataView.threadGroupName](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/threadgroupname.md)
* [FrameDataView.threadName](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/threadname.md)
* [FrameDataView.threadId](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/threadid.md)
* [FrameDataView.frameStartTimeMs](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/framestarttimems.md)
* [FrameDataView.frameStartTimeNs](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/framestarttimens.md)
* [FrameDataView.frameTimeMs](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/frametimems.md)
* [FrameDataView.frameTimeNs](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/frametimens.md)
* [FrameDataView.frameGpuTimeMs](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/framegputimems.md)
* [FrameDataView.frameGpuTimeNs](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/framegputimens.md)
* [FrameDataView.frameFps](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/framefps.md)
* [FrameDataView.sampleCount](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/samplecount.md)
* [FrameDataView.maxDepth](/engine/6000.5/script-reference/unityeditor/profiling/framedataview/maxdepth.md)
