yes, correct - my code is just the performance test, which IMHO is the first step and surprisingly tricky due to effects from the loop around it.
The code for dynamic enable/disable is trivial but the design is a bit subjective. For example, another API might be set_dbg_output(bool) and then maybe get_dbg_output() to inspect the current state.
An alternative route might be to find a way to integrate this code with a logging library like spdlog.
This way you'd get the cool short notation of dbg(...) and the ability to have more control about the sinks (including indeed dynamic disabling/enabling).