[Dev] Profiling techniques
Phillip J. Eby
pje at telecommunity.com
Fri Sep 9 17:48:58 PDT 2005
At 03:49 PM 9/9/2005 -0700, Alec Flett wrote:
>A while back, I added some stuff to the detail view to turn
>on/off profiling for CPIA events. If you Go to test->Start Profiler,
>you'll get a file called 'Events.prof' in the current directory. The nice
>thing about this is that it ONLY logs CPIA events as they are dispatched,
>and does not profile stuff like mouse movement and so forth. You can
>profile events, turn off the profiler, then load up the Events.prof file
>in a python session.. from there, you can do everything Phillip describes...
>
>However, I haven't used in a while. I used to be able to say:
> >>> from pstats import Stats
> >>> s = Stats('Events.prof')
>
>but now I get an exception.. not sure whats up with that?
See below, and also my comments on revision 7074 at:
http://viewcvs.osafoundation.org/chandler/?rev=7074&view=rev
>Phillip J. Eby wrote:
>>Profiling in the Chandler UI is pretty simple. From the "Test" menu
>>select "Start Profiler", and then do whatever it is you want to
>>profile. Then select "Stop Profiler". This creates a file called
>>"Events.prof", which you can analyze by opening a Python shell from the
>>"Test" menu, and then doing something like this (it helps if you maximize
>>the window):
>>
>> >>> from hotshot.stats import load
>> >>> s=load('Events.prof')
>> >>> s.sort_stats("cum").print_stats(20)
>> 187634 function calls (170697 primitive calls) in 3.675 CPU
>> seconds
>>
>> Ordered by: cumulative time
>> List reduced from 874 to 20 due to restriction <20>
...
More information about the Dev
mailing list