since you are already modifying source, go and put your profiling into a tool!
The current implementation might work but does not make sense.

Create a Tool which takes a project/mainfile and creates an instrumented version of it.


MY Website with news of my projects:
(for example my current
Muliplayer Bomberman,
GenesisPrecompiler for LiteC
and TileMaster, an easy to use Tile editor)
Sparetime-Development