Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!news.mathworks.com!tank.news.pipex.net!pipex!lade.news.pipex.net!pipex!mk2!
From: dpeachey@vmark.co.uk (Dan)
Subject: Re: I Need a Profiler for ENFIN Object Studio V4.00.1
Organization: VMark Software Ltd.
Date: Tue, 12 Mar 96 14:11:27 GMT
Message-ID: <1996Mar12.141127.22314@vmark.co.uk>
X-Newsreader: Forte Free Agent 1.0.82
References: <Do4Lv1.9r4@mtnlake.com>
Sender: @vmark.co.uk
Lines: 89

drew@mtnlake.com (Drew Atkins) wrote:


>I need a time-based profiler for ENFIN Object Studio.  The profiler
>that comes with ENFIN simply counts the number of times each message
>is sent, which is useless for figuring out where your software spends
>most of its time.  I would also appreciate any tips on building a
>time-base profiler for ENFIN Object Studio.

>Thanks, Drew Atkins

>Mountain Lake Software
>133 King Street East
>Third Floor
>Toronto, Ontario
>Canada, M5C 1G6

>Voice: 	(416) 863-8896
>Fax:	(416) 863-8989
>E-Mail:	drew@mtnlake.com

Hello again,

OK..  This is what I tried...

Load up the Profiler tool...  Hell,  we might as well Reuse if we can!
Go into the class browser  and overwrite the start method to set the
sendHooks to something like #TimerProfile.  Remember to save this
method into a new file, as not to overwrite the original.

Now we need to define our Hook.

First create a new class called ProfileTransaction,
its got 4 instance attributtes

executeTime
reciever
message
args
(use the modelling tool to generate accessors etc).

Now write a class method,  something along the lines of:

newReciever: aRec message: aMess args: someArgs

|temp|
 temp := self new.
 temp reciever: aRec;
         message: aMess;
         args: someArgs;
         executeTime: (Time now).
 ^temp.

So now we can create instances of a timed profile transaction.
Now we need to store these somewhere:

Create a global Log.
i.e from workspace do:
		Log := Array new.

Now create hook:

		SendHooks at: #TimerProfile put: [:reciever :mess :args |
						Log add: (ProfileTransaction
						newReciever: reciever
						message: mess
						args: args)].

Execute this.
When you run the profiler this time it should kick of this code.
When you finish, inspect Log and you will find a collection of
ProfileTransactions.

Voila.  This is very basic and there is much room for improvement,
but it functions and should get you off to a good start.

Mail me if you have any problems.

Thanks

Dan

Object Studio Support Analyst (VMark UK)

My opinions are my own.




