Construct a zone to record with specified _profiler.
Destructor. Emits the zone end event with the Profiler.
A shortcut to call variableEvent() of the zone's profiler, if any.
// 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 }
Zone of profiled code.
Emits a zone start event (recording start time) at construction and a zone end event (recording end time) at destruction.