After finding that Visual Studio 2005 Professional doesn't appear to contain a profiler, I got a copy of LTProf for shareware. However there are two linked problems:
1)If I don't use the debug build of my app, the majority of the function/method calls are not listed in the profiling analysis.
2)If I use the debug build, the timings are not very useful because I use a lot of STL, and STL is horrendously slow in debug builds.
So, is there any way around this? And is there a better profiler that's free? How can they get away without including one in VS - seems you have to buy the Team version for a profiler!
I tried writing my own:
map<string,pair<__int64,int> > CallData;
class ASMTimer
{
public:
ASMTimer(string &name) : Name(name)
{
++CallData[Name].second;
Start=__rdtsc();
}
~ASMTimer()
{
End=__rdtsc();
CallData[Name].first+=End-Start;
}
private:
unsigned __int64 Start,End;
string Name;
};
You use it like:
class::method()
{
ASMTimer Timer("Class::Method");
...
}
Of course it's basic but it seems reasonably OK. I wonder if I'm better off using this?