# ProfilerMarkerData

> Describes Profiler metadata parameter that can be associated with a sample.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Profiling.LowLevel.Unsafe](/engine/6000.3/script-reference/unity/profiling/lowlevel/unsafe.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
public struct ProfilerMarkerData
```

## Remarks

Used with [ProfilerUnsafeUtility.BeginSampleWithMetadata](/engine/6000.3/script-reference/unity/profiling/lowlevel/unsafe/profilerunsafeutility/beginsamplewithmetadata.md) method. The [ProfilerMarkerData.Type](/engine/6000.3/script-reference/unity/profiling/lowlevel/unsafe/profilermarkerdata/type.md) value defines the data type [ProfilerMarkerData.Ptr](/engine/6000.3/script-reference/unity/profiling/lowlevel/unsafe/profilermarkerdata/ptr.md) points to. The value must be a [ProfilerMarkerDataType](/engine/6000.3/script-reference/unity/profiling/lowlevel/profilermarkerdatatype.md) enum value.

## Examples

```csharp
using Unity.Collections.LowLevel.Unsafe;
using Unity.Profiling;
using Unity.Profiling.LowLevel;
using Unity.Profiling.LowLevel.Unsafe;
using System;

class Example
{
    static IntPtr MakeMarkerWithIntMetadata(string name, string paramName)
    {
        var handle = ProfilerUnsafeUtility.CreateMarker(name, ProfilerUnsafeUtility.CategoryScripts, MarkerFlags.Default, 1);
        ProfilerUnsafeUtility.SetMarkerMetadata(handle, 0, paramName, (byte)ProfilerMarkerDataType.Int32, (byte)ProfilerMarkerDataUnit.Count);
        return handle;
    }

    static readonly IntPtr markerHandle = MakeMarkerWithIntMetadata("MyMarker", "Work Idx");

    static unsafe void DoWork(int num)
    {
        var metadata = stackalloc ProfilerMarkerData[1];
        metadata[0].Type = (byte)ProfilerMarkerDataType.Int32;
        metadata[0].Size = (uint)UnsafeUtility.SizeOf<int>();
        metadata[0].Ptr = UnsafeUtility.AddressOf(ref num);
        ProfilerUnsafeUtility.BeginSampleWithMetadata(markerHandle, 1, metadata);
        //...
        ProfilerUnsafeUtility.EndSample(markerHandle);
    }
}
```

## Fields

| Value                                                                                              | Description                          |
| -------------------------------------------------------------------------------------------------- | ------------------------------------ |
| [Ptr](/engine/6000.3/script-reference/unity/profiling/lowlevel/unsafe/profilermarkerdata/ptr.md)   | Raw pointer to the metadata value.   |
| [Size](/engine/6000.3/script-reference/unity/profiling/lowlevel/unsafe/profilermarkerdata/size.md) | Size of the metadata value in bytes. |
| [Type](/engine/6000.3/script-reference/unity/profiling/lowlevel/unsafe/profilermarkerdata/type.md) | Metadata type.                       |
