SuperProfiler Speed Improvement and Bug Fix

Just a quick update. Here is the change list:

  • Changed from using std::string to using const char * to improve overall speed
  • Changed SuperRoot::PopProfile() and SuperStack::Pop() to accept a name parameter, this helps SuperProfiler to find any mismatches in pushes and pops
  • Added SuperException which is thrown if an unmatched pop is detected (really useful actually)
  • Added SUPER_PROFILE_PUSH and SUPER_PROFILE_POP macros which are useful if you want to access SuperProfile from a scripting langauge that doesn’t support RAII (cough, Lua, cough), Still use SUPER_PROFILE whenever you can however
  • Fixed a bug when there was no SUPER_PROFILE in a root parent function call (such as a main function). I would suggest not profiling a main type function, anything that only returns at exit
If you find any issues, please post them to the bug tracker here: http://code.google.com/p/superprofiler/issues/list

SuperProfiler Update and Screenshots

I just updated SuperProfiler with support for comma separated value and XML output as noted here. There were a few other small changes as well.

This is an example of what you can do with the CSV output if you load it into a spreadsheet program:

Read the rest of this entry »

SuperProfiler to the rescue!

SuperProfiler is a library I wrote to help us track down performance issues in Zero Gear. It is open source so anyone can use it (and hopefully help make it better!).

You simply place a piece of code at the start of any function you want to profile and SuperProfiler takes care of the rest.

An example…


void SomeFunction2(int var1)
{
    SUPER_PROFILE(”void SomeFunction2(int var1)”);
    var1++;
}

void SomeFunction1(void)
{
    SUPER_PROFILE(”void SomeFunction1(void)”);
    int lala = 2;
    SomeFunction2(1);
}

void main(void)
{
    SomeFunction1();
    SuperProfiler::TextOutput textOutput(”SuperProfilerResults.txt”);
    SuperProfiler::Root::OutputResults(textOutput));
}

and in SuperProfilerResults.txt is…


Function List | Total Run Time=0 | Total Profiled Function Calls=2
—————————————–
void SomeFunction1(void) | Total Time=0.00 | 50.00% of time | Total Calls=1 | 50.00% of calls
void SomeFunction2(int var1) | Total Time=0.00 | 50.00% of time | Total Calls=1 | 50.00% of calls

Call Tree
—————————————–
ROOT
    void SomeFunction1(void) | Avg Time=0.0000 | Times called=1
        void SomeFunction2(int var1) | Avg Time=0.0000 | Times called=1

Simple and easy. Check out the Google code site for all the juicy details.

Let me know if you find it useful!