Can't Get Profiler to Spit Out Data
by Demolishun · in Torque Game Engine · 10/07/2006 (11:47 am) · 5 replies
I have followed the information in these threads:
tdn.garagegames.com/wiki/Torque/Profiler
www.garagegames.com/docs/tge/engine/classProfiler.php
I have this code setup to run the profiler:
I did compile in debug mode (it will be months before I do a release build), but whenever I press "ctrl F3" it just states the text in the above function with no profiler data coming out of the dump.
Some other wierdness is that if I try the profiler inside the GUI before going into the sim, or while my guy is falling to the surface after spawning then Torque crashes if I press "ctrl F3".
I do have the appropriate macros for the code I care about and they are balanced. Also, I figured other code probably still have profiler macros and I should see that too. Right now I get nothing in the console or command line from where Torque was launched.
tdn.garagegames.com/wiki/Torque/Profiler
www.garagegames.com/docs/tge/engine/classProfiler.php
I have this code setup to run the profiler:
function doProfile(%val)
{
if (%val)
{
// key down -- start profile
echo("Starting profile session...");
profilerDump();
profilerEnable(true);
}
else
{
// key up -- finish off profile
echo("Ending profile session...");
profilerDump();
profilerEnable(false);
}
}
GlobalActionMap.bind(keyboard, "ctrl F3", doProfile);I did compile in debug mode (it will be months before I do a release build), but whenever I press "ctrl F3" it just states the text in the above function with no profiler data coming out of the dump.
Some other wierdness is that if I try the profiler inside the GUI before going into the sim, or while my guy is falling to the surface after spawning then Torque crashes if I press "ctrl F3".
I do have the appropriate macros for the code I care about and they are balanced. Also, I figured other code probably still have profiler macros and I should see that too. Right now I get nothing in the console or command line from where Torque was launched.
About the author
I love programming, I love programming things that go click, whirr, boom. For organized T3D Links visit: http://demolishun.com/?page_id=67
#2
I did find an imbalanced one inside my object code and fixed it. It would cause a crash even if I was not trying to profile. Now it just seems to crash anytime I try to profile. The profiler looks like it is enabled (from torqueConfig.h:
I had tried enabling from the gcc command line: -DTORQUE_ENABLE_PROFILER, but the compiler complained how it was already defined so I assumed the above code from torqueConfig.h was working. I have performed 'make clean' and make already.
10/07/2006 (1:59 pm)
Callstack from GUI (not in mission, just menu screen):#0 0x082d26df in ProfilerInstance::printSortedRootData (
rootVector=@0xbf9148d0, totalTime=-2.1762891946203554e-268)
at platform/profiler.cc:492
#1 0x082d2a97 in ProfilerInstance::dump (this=0x85cbc10)
at platform/profiler.cc:608
#2 0x082d231f in ProfilerInstance::hashPop (this=0x85cbc10)
at platform/profiler.cc:389
#3 0x082d31c9 in Profiler::hashPop (this=0x858efa0)
at platform/profiler.cc:790
#4 0x081b0cd3 in DemoGame::main (this=0x853e560, argc=1, argv=0xb6fd6528)
at game/main.cc:464
#5 0x0839506d in main (argc=1, argv=0xbf914a64)
at platformX86UNIX/x86UNIXWindow.cc:886I did find an imbalanced one inside my object code and fixed it. It would cause a crash even if I was not trying to profile. Now it just seems to crash anytime I try to profile. The profiler looks like it is enabled (from torqueConfig.h:
#ifdef TORQUE_SHIPPING // TORQUE_SHIPPING flags here. #else // enable the profiler by default, if we're not doing a shipping build # define TORQUE_ENABLE_PROFILER #endif
I had tried enabling from the gcc command line: -DTORQUE_ENABLE_PROFILER, but the compiler complained how it was already defined so I assumed the above code from torqueConfig.h was working. I have performed 'make clean' and make already.
#3
10/07/2006 (4:18 pm)
Aha! I went to a clean copy of Torque 1.4.2 and tried the same thing. It crashed. I determined that you cannot call: profilerDump(); until you have actually profiled or it will crash. I may try and find out, but I think it should just ignore the call rather than crash.
#4
I fixed the wiki page to reflex this.
10/07/2006 (4:33 pm)
Here is a better key script than shown above://
// Start profiler by pressing ctrl f3
// ctrl f3 - starts profile that will dump to console and file
//
function doProfile(%val)
{
if (%val)
{
// key down -- start profile
echo("Starting profile session...");
//profilerDump(); // if profiler has not been run then this will crash
profilerReset();
profilerEnable(true);
}
else
{
// key up -- finish off profile
echo("Ending profile session...");
profilerDump();
profilerDumpToFile("profilerDumpToFile" @ getSimTime() @ ".txt");
profilerEnable(false);
}
}
GlobalActionMap.bind(keyboard, "ctrl F3", doProfile);I fixed the wiki page to reflex this.
#5
10/07/2006 (5:49 pm)
Ooops, dumpToFile is defined in profiler.h, but does not exist as a function nor a consolemethod. I will create and test that and post it here.
Torque Owner Stefan Lundmark
It does not matter if you are in debug or release, should work in both :)
Sounds like an unbalanced profiler start/end, but you said it balanced so what's the callstack and where does it crash? Did you make sure to define the profiler in torqueConfig.h?