c++ - profiler : enable/disable depend on value of a (global?) variable -
i want profile @ time-steps. game.
my game loop (heavily simplified):-
for(int t=0;t<1000000;t++){ dogameloop(); // logic -> physic -> graphic -> sleep -> clear allocator ... };
in visual studio, how profile dogameloop()
e.g. when 43<=t<=45
?
want profile while -o2
turn on (release mode).
now, can profile whole program via
(top bar) > debug > performance profiler > cpu usage
.
show graphical tree https://blogs.msdn.microsoft.com/devops/2015/10/29/profile-your-cpu-in-the-debugger-in-visual-studio-2015/.
i don't mind solution make t
global variable, or insert microsoft-specific piece of code near dogameloop()
.
prefer not change other parts of code.
(i have searched solution few months.)
i heard queryperformancecounter
may help, have no idea it.
Comments
Post a Comment