Jump to content

Profiler?


Recommended Posts

The in-game profiler (press F11 to toggle, then press numbers to drill down) is in ps/Profile.cpp and ProfileViewer.cpp, originally based on "Real-Time Hierarchical Profiling" from GPG3.

For much-lower-overhead in-game measurement there's also some macros in lib/timer.h - look for its comments on TIMER and TIMER_ACCRUE, which measure a block and dump the timings into Visual Studio's debug output window (on Windows) or stdout (on Linux/OS X).

The timer implementation depends on OS - see lib/timer.cpp, which usually uses clock_gettime on non-Windows platforms and uses lib/sysdep/os/win/whrt/ on Windows. whrt picks one of many timers depending on what's considered accurate and safe. (docs/timing_pitfalls.pdf documents the rationale.)

For more detailed profiling I usually use Valgrind's callgrind tool on Linux with KCachegrind, since it's nice and precise (it counts every instruction) and consistent, though not entirely representative of real low-level performance.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...