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.
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).
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).
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%.
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