Game Development Community

1.5 Out of the box profilerDump() crashes

by Terence Tan · in Torque Game Engine · 11/09/2006 (1:12 am) · 0 replies

I was going back to collect some profiling data after switching to 1.5 and I found out that the profiler crashes.

To replicate:
1) Untouched 1.5 engine
2) Compiled debug build
3) Run stronghold level in fps.starter
4) Open console
5) Type profilerDump();

Crash breakpoints in profiler.cc:
void ProfilerInstance::printSortedRootData(Vector<ProfilerRootData*> &rootVector, F64 totalTime)
{
   printFunc("Profiled blocks ordered by non-sub total time:");
   printFunc("");
   printFunc("%%NSTime  %% Time  Invoke #  Name");
   for(U32 i = 0; i < rootVector.size(); i++)
   {
      printFunc("%7.3f %7.3f %8d  %s",
         F32(100 * (rootVector[i]->mTotalTime - rootVector[i]->mSubTime) / totalTime),
         F32(100 * rootVector[i]->mTotalTime / totalTime),
         rootVector[i]->mTotalInvokeCount,
===>  rootVector[i]->mRoot->mName);

I was a bit shocked. I believe profilers may NOT be initialized or enable properly. A workaround is:

So doing this in the console
1) profilerEnable(true);
2) profilerDump();

works.