Skip to content
bombomby edited this page Jan 21, 2015 · 16 revisions

Step 1: Download

Download and unzip archive with precompiled libraries:

  • Brofiler.exe (GUI for visualizing results)
  • Profiler.h (Header to include)
  • ProfilerCore.lib (Library to link)
  • ProfilerCore.dll (DLL with implementation)
  • EasyHook32.dll (EasyHook)
  • ProfilerTest.exe (Small console application to test profiler)

Step 2: Integration

  • Add recently unpacked directory to Project Properties -> C/C++ -> Additional Include Directories
  • Add ProfilerCore.lib to Project Properties -> Linker -> Input -> Additional Dependencies
  • Find Main Loop of your Game and insert PROFILER_FRAME macros:
#include "Profiler.h"

while(true)
{ PROFILER_FRAME
  ...
}
  • Copy ProfilerCore.dll and EasyHook32.dll to your working directory

Step 3: First Launch

Launch your Game.
Launch Brofiler.exe.
Click Start Button .

When you are ready click Stop Button .
If your see a picture similar to this one - everything is OK, move to the next step.

Step 4: Instrumentation Profiler

Add some profiling counters to your code.

#include "Profiler.h"

//Just add PROFILE macros at the beginning of the function
void Engine::UpdateInput()
{ PROFILE

}

Add some profiling categories to your code (colorized counters).

#include "Profiler.h"

//There is a lot of predefined standard colors
void Engine::UpdateLogic()
{ PROFILER_CATEGORY( "UpdateLogic", Profiler::Color::Orchid )
  
}

Step 5: Sampling Profiler

Check suspect functions in the table.

From now these functions are marked for sampling.
All the code inside the scope of these functions will be sampled during next run.
Click Start Button to start new profiling run, press Stop Button to get results.
Click to clear all sampling scopes.

Step 6: Hooking Profiler

Open any Sampling Frame. Click a checkbox in the table with sampling results to inject profiler counter inside this function.

Get another profining run.
Click to remove all injected counters.

Step 7: Source View

Double click on any row in the table will open Source View window.

Step 8: Save and Load

Click to save *.prof file with active session.
Drag and Drop any *.prof file on the timeline to load it.

Clone this wiki locally