Thrill
0.1
|
When developing time critical algorithms, one often needs timers and counters that should later disabled during production. This usually means that the corresponding timer/counter lines are just removed. If later a bug is found, the timer lines have to be readded.
The StatsCounter and StatsTimer classes provide a solution to this problem: they can be disabled using a boolean template switch, and when disabled, all operations on the object are no-operations. Hence, in production mode they are compiled-out.
See the example in tests/common/stats_timer_test.cpp