Game Development Community

Missing profiler functions in TGEA 1.02

by Sim Ops Studios (#0002) · in Torque Game Engine Advanced · 09/17/2007 (1:07 pm) · 3 replies

Hi all,

I've noticed that between TGEA 1.01 and 1.02, a number of profiler-related functions just... disappeared. Specifically, the profilerReset and profilerDumpToFile TorqueScript functions are gone.

I took a peek into platform/profiler.cpp and in fact, the ONLY profiler functions that remain are profilerEnable and profilerDump; that means that profilerEnableMarker, profilerReset and profilerDumpToFile are all gone.

I noticed in the changelog that the profiler from TGE was merged in; does the TGE profiler lack these functions? Is there some other way that we are intended to access this functionality from TorqueScript in TGEA 1.02+?

Thanks,
-lem

#1
09/19/2007 (1:16 pm)
Howdy,

I assume you're talking about script - those functions are still present in the C++ profiler code. Looks like the ConsoleFunctions to expose them disappeared.

The missing code is going to look something very much like:

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

ConsoleFunction(profilerReset, void, 1, 1, "() - Reset profiler state.")
{
if(gProfiler) gProfiler->reset();
}

ConsoleFunction(profilerEnableMarker, void, 3, 3, "(string blockName, bool enable) - Set enabled state of a profiler block to the value of enable.")
{
if(gProfiler) gProfiler->enableMarker(argv[1], dAtob(argv[2]));
}

That ought to get you going again. Let me know if you run into any other problems. These lines of C++ code should be added at the end of engine/platform/profiler.cpp.
#2
09/19/2007 (1:19 pm)
Further investigation reveals that enableMarker isn't implemented. Is this used by anyone? Although the idea is sound, I've never seen it used. If someone needs it I'll see that it gets reimplemented immediately.
#3
09/19/2007 (1:45 pm)
Hi Ben,

Yes, I did mean from script; sorry for not specifying, I meant to but must have forgot.

That does bring up an interesting point though, which I didn't realize myself until just now (I thought it was just a script issue until I tried to compile); I tried adding your suggested code (which looks correct) but I discovered that, in fact, the functions in question aren't actually implemented at the C++ layer, either.

More specifically, they are declared in profiler.h (so the compiler is happy), but the actual implementation seems to be missing from profiler.cpp (linker not so happy!).

Kind of strange!

As for enableMarker, we don't use it; I must admit I don't even know what it does. dumpToFile and reset are the two functions that we were using.