[squeak-dev] AndreasSystemProfiler Released MIT

Eliot Miranda eliot.miranda at gmail.com
Thu Jan 24 18:10:32 UTC 2013


On Wed, Jan 23, 2013 at 12:58 PM, Ron Teitelbaum <ron at usmedrec.com> wrote:

> Hello All,
>
> In Memory of Andreas Raab
> http://forum.world.st/In-Memory-of-Andreas-Raab-td4663424.html
>
> We have renamed and released the AndreasSystemProfiler.
>

Both AndreasSystemProfiler and MessageTally are periodic sampling
profilers.  The essential difference between AndreasSystemProfiler and
MessageTally is in how the current method is sampled.

MessageTally is driven from a high-priority process in a loop waiting on a
delay.  When the delay fires the lower-priority process being profiled is
interrupted, its stack is walked to determine the methods along the call
chain, and that data is recorded.  But since the sampling occurs when the
high-priority process preempts the lower-priority process, a sample is only
taken at a preemption point.  In particular, primitives are *not* profiled
because they are not suspension points.  A process can only be suspended on
method activation (a non-primitive method activation, or primitive failure)
or on backward branch.  The cost of primitives is charged to a caller and
is inferred by subtracting the cost of children of the caller from the
caller itself (subtracting the number of samples in children of the caller
form the number of samples in the caller itself).

Another problem is that using the clock that underlies Delay, which is
typically the clock used by processes being profiled, causes sampling
errors due to the sampling and sampled processes cohering.  Delays are
limited in resolution (at best 1 millisecond) so if the profiled process
waits on a delay it'll fire immediately after the profiling process
(because the profiling process is at higher priority) and so the sampling
process may only ever see the sampled process in a wait state.

If MessageTally is used to profile multiple processes then a third problem
is that if a primitive causes a process switch then its cost will end up
being charged to the process switched-to, not switched from.  This is again
because sampling can only occur after a primitive has completed
(successfully or not).

AndreasSystemProfiler is driven from a high-priority process in a loop
waiting on a Semaphore known to the VM.  The profiling process uses a
primitive to schedule a sample some number of ticks of the VM's
high-performance clock in the future.  When the time is reached the VM
samples the current method and the current process, *before any process
preemption takes place*, and independently of the standard clock, and
signals the semaphore.  The profiling process then collects the
method,process pair via primitives.  So AndreasSystemProfiler provides much
more accurate results.

That said there are still limitations with primitives and Cog.  Currently
Cog only samples "interpreter" primitives.  Those primitives it implements
in machine code (integer and float arithmetic, closure evaluation, at:,
identityHash) are not sampled and won't show up; they will be charged to
the calling method.  This is fixable, since Cog actually compiles the
sampling direct into interpreter primitive invocation when profiling is in
effect and not at other times, but sampling could be a significant cost in
these simple and performance-critical primitives.

http://ss3.gemstone.com/ss/AndreasSystemProfiler.html
>
> Using the MIT License.
>
> Thank you Eliot for your help to get this ready.  The profiler works with
> Squeak 4.4.
>
> All the best,
>
> Ron Teitelbaum, Julie LeMoine and David Smith
>
> > -----Original Message-----
> > From: squeak-dev-bounces at lists.squeakfoundation.org [mailto:squeak-dev-
> > bounces at lists.squeakfoundation.org] On Behalf Of Andreas.Raab
> > Sent: Friday, January 11, 2013 1:39 PM
> > To: squeak-dev at lists.squeakfoundation.org
> > Subject: [squeak-dev] Re: Profiling
> >
> > Levente Uzonyi-2 wrote
> > > It uses some primitives which were added to the CogVM, so it requires
> Cog.
> > > We could reimplement it from scratch using the same primitives and get
> > > a better profiler in the image. We can't include this due to the GPL
> > > license.
> >
> > Or ask Ron if 3dicc (which bought all the rights to the Teleplace IP and
> > Software) can re-release the code under a more permissable license.
> >
> > Cheers,
> >   - Andreas
> >
> >
> >
> >
> > --
> > View this message in context: http://forum.world.st/Profiling-
> > tp4662704p4662987.html
> > Sent from the Squeak - Dev mailing list archive at Nabble.com.
> >
>
>
>
>


-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20130124/56948db4/attachment.htm


More information about the Squeak-dev mailing list