# SumAllSamplesInFrame

> Use to sum all samples within a frame and collect those as one sample per frame.

## Definition

* **Type:** Field
* **Namespace:** [Unity.Profiling](/engine/6000.6/script-reference/unity/profiling.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
SumAllSamplesInFrame = 16
```

### Remarks

```csharp
using System;
using Unity.Profiling;
using UnityEngine;

public class CollectGCAllocCountExample2
{
    static void PrintGCAllocCount(Action a)
    {
        using (var gcAllocRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Internal, "GC.Alloc", 1, ProfilerRecorderOptions.SumAllSamplesInFrame | ProfilerRecorderOptions.CollectOnlyOnCurrentThread))
        {
            a.Invoke();

            gcAllocRecorder.Stop();

            var count = gcAllocRecorder.Count == 0 ? 0 : gcAllocRecorder.GetSample(0).Count;
            Debug.Log("GC allocs count: " + count);
        }
    }
}
```

Additional Resources: [ProfilerRecorderSample](/engine/6000.6/script-reference/unity/profiling/profilerrecordersample.md).
