Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
How to write a custom tracer/profiler?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Gabriel Genellina, post: 3589253"] You don't have to use a profiler; just replace the original DS functions that you're interested in monitoring, with a "wrapped" version that logs its parameters and then calls the original code. A skeleton example (suppose DS.open is one function you want to monitor): import DS original_open = DS.open def wrapped_open(*args, **kw): trace("open", *args, **kw) return original_open(*args, **kw) DS.open = wrapped_open This approach has some problems (it does not preserve the original function signature, by example). You may overcome this (and other problems) using the decorator module from M. Simionato; see <[URL]http://www.phyast.pitt.edu/~micheles/python/documentation.html[/URL]> [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
How to write a custom tracer/profiler?
Top