A longer description of the profiler may be found on
http://www.bergel.eu/download/papers/Berg10aProfiling.pdf
We recently got this paper accepted.
Cheers,
Alexandre
On 19 Jan 2010, at 22:03, Alexandre Bergel wrote:
Dear List,
Over the last few months I put some effort on a new profiler for
Pharo. It has been used on a number of projects. Time has come to
share it with you.
To install it, just doit the following expression in a workspace
(Mondrian will also be installed):
-=-=-=-=-=-=-=-=-=-=-=-=
Gofer new
squeaksource: 'MetacelloRepository';
package: 'ConfigurationOfSpy';
load.
(Smalltalk at: #ConfigurationOfSpy) perform: #loadDefault
-=-=-=-=-=-=-=-=-=-=-=-=
To invoke the profiler, use the following template:
ProfilingPackageSpy viewProfiling: [ "YOUR CODE" ] inPackage:
'YourPackageName'
ProfilingPackageSpy viewProfiling: [ "YOUR CODE" ]
inPackagesMatching: 'PackageName*'
Replace "YOUR CODE" by an expression. Some examples are provided in
the class ProfilingPackageSpy (method category 'example'). You can
find profilings of Mondrian, Glamour, Moose/CAnalyzer, O2.
The profiling of Mondrian looks like this:
-=-=-=-=-=-=-=-=-=-=-=-=
ProfilingPackageSpy
viewProfiling: [
| view |
view := MOViewRenderer new.
view nodes: (1 to: 100) forEach: [:each | view nodes:
(1 to: 100)].
view root applyLayout
]
inPackage: 'Mondrian'
-=-=-=-=-=-=-=-=-=-=-=-=
There are two things you should keep in mind:
- "YOUR CODE" will be executed twice. The first time with message
Tally, then the second time with the full instrumentation. The second
execution should not be impacted by the first execution.
- You cannot instrument the whole image. I need more time to make this
happens. Therefore, you cannot provide '*' to inPackagesMatching:
How to read the picture:
- big rectangle are classes
- edges represent class inheritance
- inner rectangles are methods:
* height = total time that the method has been executed
* width = number of time the method has been executed
* color = number of different receiver: white = the method has
been executed on 1 receiver. black = many receivers
You can do a right-click on a method, and select viewInvocation. This
opens a second view that show the execution flow. A different mapping
of metrics is used:
- rectangle = methods
- edges = invocation (upper invokes below)
- gray color = method that always return 'self'. It corresponds to
void methods in Java or C++. It is therefore likely that the method
performs a side effect
- yellow color = method that always returns the same value for a
particular object
- width and height are as in the first visualization
Keep in mind that you mind encounter a freeze of your image if you
instrument sensitive methods.
I would be sincerely delighted to have experience report on this.
Regards,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project