PEP 669: Low Impact Monitoring for CPython
Hi, I would like to announce latest PEP, PEP 669: Low Impact Monitoring for CPython. The aim of this PEP is to provide an API for profilers, debuggers and other tools to avoid the punitive overhead of using sys.settrace. If you have any interest in profilers, debuggers, coverage tools or anything of that ilk, then do please take a look. There is no change to the language and it adds 7 functions to the sys module, so shouldn't be too intrusive for those of who aren't planning on implementing any of those tools. As always, all feedback and comments are welcome. You can read the PEP here: https://python.github.io/peps/pep-0669/ Cheers, Mark.
Interesting! Some remarks about the proposed API. On Tue, Dec 7, 2021 at 4:58 PM Mark Shannon <mark@hotpy.org> wrote:
There is no change to the language and it adds 7 functions to the sys module, so shouldn't be too intrusive for those of who aren't planning on implementing any of those tools.
Where are event constants defined, like PY_CALL? Would it make sense to add a small module for these event constants and functions? Would it be possible to define enums (rather than simple ints) for these event constants, to ease debugging? sys.get_monitoring_events()->int sys.set_monitoring_events(event_set: int) sys.get_local_monitoring_events(code: CodeType)->int sys.set_local_monitoring_events(code: CodeType, event_set: int) sys.register_monitoring_callback(event: int, func: Callable) sys.insert_marker(code: CodeType, offset: int, marker_id=0: range(256)) sys.remove_marker(code: CodeType, offset: int) For example: monitoring_events.get_events()->int monitoring_events.set_events(event_set: int) monitoring_events.get_local_events(code: CodeType)->int monitoring_events.set_local_events(code: CodeType, event_set: int) monitoring_events.register_callback(event: int, func: Callable) monitoring_events.insert_marker(code: CodeType, offset: int, marker_id=0: range(256)) monitoring_events.remove_marker(code: CodeType, offset: int) monitoring_events.PY_CALL (... other constants ...) Victor -- Night gathers, and now my watch begins. It shall not end until my death.
On 12/7/2021 10:41 AM, Mark Shannon wrote:
I would like to announce latest PEP, PEP 669: Low Impact Monitoring for CPython.
The aim of this PEP is to provide an API for profilers, debuggers and other tools to avoid the punitive overhead of using sys.settrace.
If you have any interest in profilers, debuggers, coverage tools or anything of that ilk, then do please take a look.
There is no change to the language and it adds 7 functions to the sys module, so shouldn't be too intrusive for those of who aren't planning on implementing any of those tools.
As always, all feedback and comments are welcome.
You can read the PEP here: https://python.github.io/peps/pep-0669/
To me, all auditing events are 'monitoring' events. You might call these particular events 'code' or 'control' or 'flow' events. The sys module doc currently consists of a nearly alphabetical list of all attributes, whether data or methods. This batch will need some discussion as a group. -- Terry Jan Reedy
participants (3)
-
Mark Shannon
-
Terry Reedy
-
Victor Stinner