Game Development Community

Negative values in Profiler output

by Robert Norris · in Torque Game Engine · 06/07/2007 (2:25 am) · 3 replies

Hi,

I am attempting to use the Profiler to solve some performance problems with a TGE application. The thing that is throwing me, is that negative values are being output.

Ordered by non-sub total time -
%%NSTime  %% Time  Invoke #  Name
  1.332 -98.668        0 ROOT
100.000   0.006      126   MainLoop
 84.424   0.060      126     TimeManagerProcessMain
 84.364 -33.344      126       ProcessTimeEvent
 41.198  41.180      126         SimAdvanceTime
  0.009   0.009     3678           MemoryFree
  0.008   0.008     3735           MemoryAlloc
  0.001   0.001       13           convertUTF8toUTF16
  0.000   0.000      580             oneUTF8toUTF32
  0.000   0.000        1           SceneGraph_rezoneObject
  0.000   0.000        3           MemoryRealloc
 38.167 -32.028      126         RenderFrame
 52.722   5.560      126           CanvasRenderControls

Can anyone explain to me what this means?

#1
06/09/2007 (2:05 am)
I've never seen negative values like that in my experience with the profiler, and furthermore it even says up at the top that they're ordered by nonsub time when if you look at the first column that says NSTIME, they appear to be ordered by hierarchy instead. Also in my dump of the profiler it doesn't list the root like that. What version of TGE is this?
#2
06/09/2007 (12:01 pm)
This is TGE 1.4.1.

I had been profiling the release version. As an experiment I tried the debug version, although in my opinion this is less useful for performance tuning, and I only got positive values. I can only presume that the profiler only works in debug mode.

Can anyone confirm this?

The information that the profiler gave me was useful as it showed be that everything was fine. The models had too much geometry which was forcing my 512MB machine to swap. Once I balanced the geometry better, the performance problem was gone.
#3
06/09/2007 (1:17 pm)
There was a sorting issue in the profiler at one time. Replace rootDataCompare() in platform/profiler.cpp this function....

static S32 QSORT_CALLBACK rootDataCompare(const void *s1, const void *s2)
{
   const ProfilerRootData *r1 = *((ProfilerRootData **) s1);
   const ProfilerRootData *r2 = *((ProfilerRootData **) s2);
   F64 t1 = r2->mTotalTime - r2->mSubTime;
   F64 t2 = r1->mTotalTime - r1->mSubTime;
   return t1 < t2 ? -1 : t2 < t1 ? 1 : 0;
}