Game Development Community

Fix for missing profiler scrpit function

by John Vanderbeck · in Torque Game Engine · 04/15/2004 (7:41 am) · 4 replies

The profiler code is missing the script function for profilerReset().

Here is code to fix it. In engine/platform/profiler.cc insert the commented code below. I've included code on both sides of it for context.

ConsoleFunction(profilerDumpToFile, void, 2, 2, "(string filename) Dump profiling stats to a file.")
{
   argc; argv;
   if(gProfiler)
      gProfiler->dumpToFile(argv[1]);
}

// JWV BEGIN Fix for missing profiler script call, profilerReset();
ConsoleFunction(profilerReset, void, 1, 1, "resets the data gathered by the profiler.")
{
   argc; argv;
   if(gProfiler)
      gProfiler->reset();
}
// JWV END Fix for missing profiler script call, profilerReset();

ConsoleFunctionGroupEnd( Profiler );

#endif

#1
04/15/2004 (10:50 am)
Good eye, John. Fix is now in HEAD.
#2
04/06/2007 (12:18 am)
I have tge 1.5 and for some reason profilerReset() isn't recognized in the console for me... I tried adding this code and I got

profiler.obj : error LNK2001: unresolved external symbol "public: void __thiscall Profiler::reset(void)" (?reset@Profiler@@QAEXXZ)
../example/torqueDemo.exe : fatal error LNK1120: 1 unresolved externals

I guess the profiler's been changed since the docs in the TDN were written. How do I reset the profiler and dump to files? I couldn't get either to work.

EDIT: the profiler resets automatically when enabled. The TDN docs are outdated.
#3
04/28/2008 (8:24 am)
Hey Stephan,
Did you get this to work? I pasted in the profilerDumpToFile code and I get errors when I compile, there is no dumpToFile function to be called? in the dump() function, if the mDumpToFile is true, then it will do write to file(with no file name specified), but it will dump to the console and when I dump to the console it crashes.....
Any help would be greatly appreciated.
Thx.
#4
04/14/2010 (8:23 pm)
neither of these are in the HEAD -- because the functions they call don't exist either. No idea why, my guess is there was a crash - bug with writing to file so they just removed the code. Near as I can tell ...