[Python-Dev] Hotshot

Nick Bastin nbastin at opnet.com
Fri Jan 23 18:44:27 EST 2004

On Jan 23, 2004, at 6:34 PM, Fred L. Drake, Jr. wrote:

> Nick Bastin writes:
>> There was some note in a presentation you gave quite a while ago that
>> HotShot could profile C extension functions, but I believe that would
>> have required a change to the main python interpreter loop.  Does it
> It would have required an interpreter change which, I believe, was
> never made.  There may be a patch for this on SourceForge; I don't
> remember.  You can search the patch and bug trackers for "hotshot" to
> see what's there; I afraid I don't remember the specific changes that
> were involved.

I can certainly contribute a patch that would allow this to occur - 
I've modified the interpreter to allow this in 2.2.2 (I still use the 
old profiler, but the patch isn't profiler specific, of course) in most 
cases, but I felt that the patch was relatively hackish, and it didn't 
work for fast_cfunction.  That being said, I can contribute it and 
maybe somebody will be interested in making it work in all cases.. :-)

> The mechanism discussed at the time would have allowed measuring the
> time spent in calls to PyCFunction objects (extension functions), but
> would not have provided per-line information for those functions.  The

Of course, it would be assumed that any kind of line coverage analysis 
would not work in extension functions.  Someone could provide a simple 
preprocessor for extension module code that would allow them to be 
built in such a way to provide that information (as many commercial 
tools do), but that's a bit of the scope of what I'm interested in at 
the moment.


More information about the Python-Dev mailing list