Zone

Zone of profiled code.

Emits a zone start event (recording start time) at construction and a zone end event (recording end time) at destruction.

Constructors

this
this(Profiler profiler, string info)

Construct a zone to record with specified _profiler.

Destructor

~this
~this()

Destructor. Emits the zone end event with the Profiler.

Postblit

this(this)
this(this)
Undocumented in source.

Members

Functions

variableEvent
void variableEvent(V value)

A shortcut to call variableEvent() of the zone's profiler, if any.

Examples

// Zones can be nested:
while(!done)
{
    auto frameZone = Zone(profiler, "frame");
    {
        auto renderingZone = Zone(profiler, "rendering");

        // do rendering here
    }
    {
        auto physicsZone = Zone(profiler, "physics");

        // do physics here
    }
}
// A nested zone must be fully contained in its parent zone, e.g. this won't work:
auto zone1 = Zone(profiler, "zone1");
while(!done)
{
    auto zone2 = Zone(profiler, "zone1");
    // WRONG: zone1 destroyed manually before zone2
    destroy(zone1);

    // zone2 implicitly destroyed at the end of scope
}

Meta