[Dev] Re: event profiling

John Anderson john at osafoundation.org
Sat Jan 22 12:14:17 PST 2005


Hi Alec:

Here's a few minor comments about your event profiler:

You're currently measuring the time spend in the method called by the 
event dispatcher, dispatchEvent. However, there is often a lot of 
overhead in dispatchEvent just looking for the block to call the method 
on. So I might include the overhead of dispatchEvent as well.

Incidently, dispatchEvent has now been moved to Block and it's a class 
method.

I'd avoid using Globals unless absolutely necessary. In this case I'd 
put your flag on the Block class -- for an example see 
eventNameToItemUUID in Block, which is used the same way.

Hacking the dispatchEvent seems ok to me. However, I'd probably ifdef 
the code debug only -- using if __debug__ around it, since it doesn't 
seem like we'd want to make our eventual customers pay the overhead for 
testing code.

Finally, rather than having 5 different onProfileNextXEventEvents 
handlers I'd have a single handler and use a ChoiceEvents in place of 
your BlockEvents. A ChoiceEvent is a BlockEvent that has an extra 
attribute "choice" which you could store the number of events to handle. 
I like this approach because it's data driven -- adds almost no extra 
data, eliminates a bunch of code, and would be user-editable when we add 
a way to view and edit the UI.

John

Alec Flett wrote:

> hey, here's that event profiling thing I've been working on, I'd love 
> your comments. Unfortunately I had to hack directly into the event 
> dispatcher - I don't know if there is a better way.
>
> http://bugzilla.osafoundation.org/show_bug.cgi?id=2329
>
>
> Alec




More information about the Dev mailing list