[Patches] [ python-Patches-920509 ] Patch to enable profiling of C functions called from python

SourceForge.net noreply at sourceforge.net
Wed Mar 24 09:12:12 EST 2004


Patches item #920509, was opened at 2004-03-21 16:25
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=920509&group_id=5470

Category: Core (C code)
Group: Python 2.4
Status: Open
>Resolution: Accepted
Priority: 5
Submitted By: Nick Bastin (mondragon)
>Assigned to: Nick Bastin (mondragon)
Summary: Patch to enable profiling of C functions called from python

Initial Comment:
This patch enables the profiling of C extension functions (and 
builtins) called via the CALL_FUNCTION opcode.  This also includes 
a modification to lib/profile.py to handle the new call type.  On my 
Powerbook 12" 867Mhz it incurs a 0.5% performance hit in the 
interpreter when profiling is not enabled.

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2004-03-24 15:12

Message:
Logged In: YES 
user_id=21627

The patch is fine, with the following changes:
- use tabs instead of spaces for indentation in C source code
- add the Misc/NEWS change

----------------------------------------------------------------------

Comment By: Nick Bastin (mondragon)
Date: 2004-03-24 00:25

Message:
Logged In: YES 
user_id=430343

BTW, I forgot to patch Misc/NEWS, so whoever commits
this should touch it.  Thanks.

----------------------------------------------------------------------

Comment By: Nick Bastin (mondragon)
Date: 2004-03-23 23:47

Message:
Logged In: YES 
user_id=430343

New patch attached to this post (and old patch removed).

This patch makes new events for all C-related calls, so old profilers
will still function properly if they ignore event types they don't
understand.  Also fixed bdb, tested hotshot, and changed the
documentation for the tracing API and the debugger event types
to document the new event types (and fixed some errors in the
names of the old events).  Also provides new data for test_profile
to compare against and modified test_profilehooks for minimal
understanding of c calls so it still passes.

regrtest passes all tests on MacOS X, and the non-profiling
performance hit is around 0.5%.

----------------------------------------------------------------------

Comment By: Nick Bastin (mondragon)
Date: 2004-03-22 23:32

Message:
Logged In: YES 
user_id=430343

I'm working on a few modifications to this patch for documentation, as 
well as fixing the messages resulting from the fact that bdb is being 
handed events it doesn't understand.  I'll post that at some point before 
PyCon starts (tomorrow, probably).

----------------------------------------------------------------------

Comment By: Nick Bastin (mondragon)
Date: 2004-03-21 16:28

Message:
Logged In: YES 
user_id=430343

Note: this patch is fully backwards with profiler use - the data file is not 
changed in any way.  Also, any 3rd party profilers which would handle 
unknown event types will still continue to work (the standard python 
profiler isn't one of those, so the patch includes a fix for that as well).

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=920509&group_id=5470



More information about the Patches mailing list