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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...