reckfellENGINE

Profiling: engine frames and C# work

Measure the relevant work; a missing C# entry does not mean zero cost.

On this page

Built-in profiling scope

When running from the editor, open Debugger → Profiler and press Start. Reproduce the problem, stop capture and select the affected frame. Frame Time (ms) selects a frame-time representation; compare the same mode and scenario.

Inclusive includes functions called by a function; Self leaves its own time. These modes only apply to functions actually present in the profile. CSharpLanguage's profiling functions in 1.0.0 do not collect C# method profiles: absence from the graph does not imply no cost.

Frame monitors and method profiles are different data. A performance frame received over remote diagnostics confirms general metrics rather than a full .NET profile. CPU time is not GPU execution time.

Measure a specific synchronous section

WorkMeasurement.cs
C#
using System;
using System.Diagnostics;

public readonly record struct WorkMeasurement(double Milliseconds, long AllocatedBytes, long Checksum)
{
    public static WorkMeasurement Run(int iterations)
    {
        if (iterations < 0 || iterations > 10_000_000)
            throw new ArgumentOutOfRangeException(nameof(iterations));
        long before = GC.GetAllocatedBytesForCurrentThread();
        long start = Stopwatch.GetTimestamp();
        long checksum = 0;
        for (int i = 0; i < iterations; i++) checksum += i;
        double elapsed = Stopwatch.GetElapsedTime(start).TotalMilliseconds;
        long allocated = GC.GetAllocatedBytesForCurrentThread() - before;
        return new WorkMeasurement(elapsed, allocated, checksum);
    }
}

The complete example warms up before Run(4096). Checksum must be 8386560; Milliseconds and AllocatedBytes vary with the run.

AllocatedBytes counts allocations made on the current thread during the call. It is not live managed-heap size or all-thread memory. Milliseconds is elapsed time for this synchronous section rather than a whole-frame cost. The checksum helps prevent accidentally replacing useful work with an empty function when comparing versions.

Compare two versions

Keep inputs, build configuration and run conditions consistent. After warmup repeat the same operation several times; examine both typical time and rare spikes. Do not compare cold Debug with warm ExportRelease or claim a speedup from one sample. Profiling instrumentation can itself affect the workload.

A separately configured .NET profiler is required for method cost attribution, async continuations and managed allocations. This small measurement does not certify its configuration or accuracy.

Objects and memory · Performance monitors

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.