How to Use FreeProfiler?

Navigation Bar: Home -> How to Use FreeProfiler?

To use FreeProfiler, you have the following steps:

1. Copy the folder "Application" to your program working directory.

2. In one cpp file of the module that you want to test its performance, add: FreeProfilerImport();

Then, you can add time record macros in your functions. FreeProfilerRecordMessageBlock(messageValue) is used for windows message procedure. FreeProfilerRecordCodeBlock(blockId, blockName) is used for C++ code blocks.


// Notice this should be kept in one line.

LRESULT CALLBACK WndProc(HWND hwnd, int message, ......)
        // Notice all these test macros should be kept in one line.
        FreeProfilerRecordCodeBlock(0, "main.cpp WndProc()");
        switch (message)

                FreeProfilerRecordCodeBlock(0, "main.cpp WndProc() time cost in default windows procedure");
                return DefWindowsProc(hwnd, message, wParam, lParam);

3. Modify the configuration file based on the working path of your application.

4. Double click to run Application\CodeBlockCollector.bat.

This tool will assign an unique Id for each FreeProfilerRecordCodeBlock. So your code will be changed to:

FreeProfilerRecordCodeBlock(1, "main.cpp WndProc()");

This tool will also generate a file named "FreeProfilerBlocks.txt". You can change the filename in the configuration xml file.

If you have specific message definitions, double click to run Application\WinMsgCollector.bat.

5. Recompile your application, run your application, and exit your application. Usually, you will find a file like "FreeProfilerResult_0122_113345.xml" in Application\Result\. It looks like this:

Any suggestions please log feature request or bug report. To contact admin, please send a mail to renqilin at
Last updated by Qilin.Ren, Jan 19th, 2009 Logo