[issue13405] Add DTrace probes

Stan Cox report at bugs.python.org
Thu Feb 2 20:08:46 CET 2012


Stan Cox <scox at redhat.com> added the comment:

This is a subset of the dtrace patch and consists of the minimal functionality
needed by systemtap.  The only files that are changed from upstream sources are
as follows.

* configure/configure.in
* Makefile.pre.in
* pyconfig.h.in
  Same changes as the dtrace patch except there is no phelper.

* pydtrace.d
  Same change as the dtrace patch except added PyFrameObject to probes.
  Instead of passing in fields like filename and function name, the systemtap
  scripts (not shown) use PyFrameObject and access the python data structures.
  The overhead for a systemtap probe is a single nop and PyFrameObject is
  possibly live at the probe point so the overhead will be minimal.  pydtrace.h
  is always generated since this file is different for dtrace and stap.

* ceval.c
  The only changes to ceval.c from the upstream version are the addition of the
  PYTHON_FUNCTION_ENTRY and PYTHON_FUNCTION_RETURN probes.
  PYTHON_FUNCTION_ENTRY is invoked directly since the overhead of the probe is
  less than the overhead of a conditional check.  The probe passes the
  PyFrameObject, as mentioned above, but nothing else.  Likewise for
  PYTHON_FUNCTION_RETURN.

systemtap tapset, not included in patch, will provide backtrace results such as:
 #0 main  at /.../python/celsius.py:19
 #1 <module>  at /.../python/celsius.py:3
 #2 celsius_to_farenheit (celsius:int ) at /.../python/celsius.py:7
and variable trace results such as:
 tuple atuple in celsius_to_farenheit at /.../python/celsius.py =  "a", "b", "c",
 list alist in celsius_to_farenheit at /.../python/celsius.py = [ 1, 2, 3,]
 set aset in celsius_to_farenheit at /.../python/celsius.py = { 1, 2, 3,}
...

----------
Added file: http://bugs.python.org/file24400/python-stap.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13405>
_______________________________________


More information about the Python-bugs-list mailing list