perfSessionBeginHook top-level property

void Function(PerfMode mode) perfSessionBeginHook
getter/setter pair

Command that opens a measurement session in the packages dusk cannot import: it zeroes wind's counters and telescope's frame buffer, and turns wind's counting ON.

The enabling half is not incidental. WindPerfCounters.enabled defaults to false and lives in fluttersdk_wind, which dusk does not depend on and cannot reach: dusk sees wind only through fluttersdk_wind_diagnostics_contracts, and the contract exposes stats() and nothing that could flip a flag. So without this hook doing it, ext.dusk.perf_begin would produce a report whose wind section reads all zeros while every other section is populated, with no error anywhere to say why. Zeroing without enabling is the same bug wearing a tidier name.

It receives the session's PerfMode because the enabling half is wrong for a timing session. Timing mode touches no profiling flag so that its milliseconds are comparable, and wind's counting sits on WindParser.parse, the hottest path in the framework: a hook that switched it on regardless would tax exactly the durations timing mode exists to report, for counters the timing report never reads.

Defaults to a no-op: a host without the perf integration wired has nothing to open.

Hosts wire the real thing by writing:

perfSessionBeginHook = (PerfMode mode) {
  WindPerfCounters.reset();
  WindPerfCounters.enabled = mode == PerfMode.attribution;
  TelescopeStore.clearFramePerf();
};

Contract: set-once-per-isolate from MagicPerfIntegration.install(). Reset to this no-op default by MagicPerfIntegration.resetForTesting(). Always paired with perfSessionEndHook; see there for why.

Implementation

void Function(PerfMode mode) perfSessionBeginHook = (PerfMode mode) {};