r1 - 11 Jan 2005 - 15:19:45 - AlecFlettYou are here: OSAF >  Journal Web  >  ContributorNotes > AlecFlettNotes > AlecFlett20050111
This is my 2nd day at OSAF and Katie suggested a good way to get started would be to take on a bug. She gave me Bug:2322, dealing with the performance of deleting an item from Chandler.

I found some interesting pages such as PerformanceProject, which addresses some performance issues, and talks a little bit about how to use HotShot. The docs were sparse so I'm trying to make it really easy to run the profiler and do an analysis.

My first goal was to add Start/Stop profiler menu items to the Test menu. That got me learning all about the Repository as well as the ParcelManager.

To add a menu item, I had to perform the following steps:

  1. Add some stuff to parcels/osaf/views/main/parcel.xml:
    • add MenuItems for StartHotshotItem and StopHotshotItem that generate appropriate events with the event tag
    • add two childrenBlocks to the TestMenu menu with itemref="doc:StartHotshotItem"
    • add childrenBlocks for each of these MenuItems
  2. Add some events to parcels/osaf/views/main/Main.py:
    • define onStartHotshotEvent to handle the StartHotshotEvent and so forth
  3. Add a global to application/Globals.py to keep track of the reference to hotshot - so that it can be created when the user starts the profiler, and is still around when the user goes to stop the profiler

The start/stop seemed straightforward enough - just call profiler.start() and profiler.stop(). The problem is that the very next thing that happens after a start() is a return on the callstack, and this is exactly what gets written out to the profile log file. Then if you're later trying to analyze the profile by running hotshot.stats, the loader fails to load it because it tries to pop the most recent call off the stack for analysis and the stack is empty. After some googling, I found this document in this Sourceforge Bug. *sigh*.

So my next solution is to be to instantiate the profiler when the user clicks start, and then sometime in the event loop, I can check if the profiler exists. If it does, then it can be started at a really low level. Hopefully it can be stopped at anytime, leaving a half-returned stack in the profile file.

Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r1 | More topic actions
 
Open Source Applications Foundation
Except where otherwise noted, this site and its content are licensed by OSAF under an Creative Commons License, Attribution Only 3.0.
See list of page contributors for attributions.