PATCH0/2: byte code profiling for gst

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

PATCH0/2: byte code profiling for gst

Derek Zhou
These patches add profiling support to gst.
Usage:

Smalltalk profileOn.
... [ the code you want to profile ]
Smalltalk profileOff.
CallGraph new printCallGraphToFile: 'profile.out'.

Which will generate a callgrind compatible profile 'profile.out' which can be viewed by kcachegrind.
Note:
* profilerOn and profileOff can be called multiple times.
* you can reset the profiler by
Smalltalk resetProfiler
* CallGraph new will capture the current profile. You can capture multiple profiles.
* the report can be generated in 2 different ways controlled by
CallGraph seperateBlocks: [true|false]
default is false, which will lump the cost of any block closure into the defining method. When true, all block closures will be treated as separate entities.

Derek


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: PATCH0/2: byte code profiling for gst

Derek Zhou
On Sunday 08 February 2009 12:02:39 pm Derek Zhou wrote:
> These patches add profiling support to gst.
> Usage:
>
> Smalltalk profileOn.
> ... [ the code you want to profile ]
> Smalltalk profileOff.
> CallGraph new printCallGraphToFile: 'profile.out'.
>
> Which will generate a callgrind compatible profile 'profile.out' which can be viewed by kcachegrind.

A few known caveats:
* byte code counter may not reflect actual execution time very well.
* As most other profilers, the inclusive costs are estimated by weighted sum of all subroutine calls.  
* the per method byte code counter is a SmallInteger (for speed) and with modern processor it does not take long (a few minutes) to overflow it (on a 32 bit machine it max at ~ 1 billion). Don't have the profiler on for too long.

Derek


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk