Understanding the Profiler

I just realized that Xojo has a built-in profiler (duh)…
But I’m not sure how to read the results?

I have one area that looks kinda like this

> Main Thread winMain.Methodname        77 / 22671.0/ 294.4
       + Module1 StringSize                               662616 / 55337.0 / 0.0835

So I thought this would mean

  • winMain.MethodName was called 77 times, and took 22,671 milliseconds total
  • Module1.StringSize (which is called INSIDE MethodName was called 662,616 times for a total of 55,337 milliseconds

BUT, if that is the case, how can the total of a CHILD process be greater that the PARENT?

I would have “assumed” (yeah, this is why I am writing this)… that the elapsed time for MethodName would include the time it took as well as the time expended on any and all called methods or functions… but that can’t be the case since StringSize itself is 30x bigger than Methodname

So I’m not sure WHERE to concentrate… is there more time being used OUTSIDE of Stringsize… or should it be StringSize itself I try to reduce the calls to or reduce the time it takes per call (0.08 is not a long time except when you multiply it by 662k)

and StringSize is pretty much

x=Ceil(zGraphics.StringWidth(s))+9

where zGraphic was precreated, and the font/size where preset (ie. one time, not 662,616 times) :slight_smile:

When you expand a row whats left is the time NOT attributable to methods called by that method
The called methods get their own entries & therefore their own times

This is explained on http://developer.xojo.com/userguide/code-profiler

You can expand methods to see the other methods that they called.
When a method is collapsed, the time shown represents the time used by the method and any methods that were called as a result of that method running.
When a method is expanded, the time shown for the method represents the time used only by the method itself. Any called methods are shown below it and have their own time values.

In the example you give I would look at whatever else is going on in

Main Thread winMain.Methodname 77 / 22671.0/ 294.4

So collapsed is the TOTAL time … expanded is the “overhead” + details of internal calls?

I see that now…
so from above, Methodname took 22671ms for everything it did EXCEPT for the StringSize calls then

Dang, I need to either reduce the # of times I need to call that , or figure out a better way.

I need to measure every string to determine the optimum columnwidth for listbox display, and it needs to be based on the contents of the “longest” cell content

I never found the information from the Xojo profiler very helpful. Instruments is way better.