[issue13405] Add DTrace probes

2012-02-02 Thread Stan Cox

Stan Cox  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   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 
<http://bugs.python.org/issue13405>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13405] Add DTrace probes

2011-12-19 Thread Stan Cox

Stan Cox  added the comment:

systemtap doesn't have have a ustack helper, but if the frame pointer were 
provided to PYTHON_FUNCTION_ENTRY, then it could be cached to provide python 
stack frame access.

--- Python/ceval.c.12011-12-07 11:18:03.733659382 -0500
+++ Python/ceval.c  2011-12-19 18:45:54.601309213 -0500
@@ -796,3 +796,3 @@
lineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
-   PYTHON_FUNCTION_ENTRY(filename, name, lineno);
+   PYTHON_FUNCTION_ENTRY(filename, name, lineno, f);

--

___
Python tracker 
<http://bugs.python.org/issue13405>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13405] Add DTrace probes

2011-12-08 Thread Stan Cox

Stan Cox  added the comment:

The patch works for systemtap except for one minor nit.  pydtrace.h, created by 
stap from pydtrace.d, is stap specific.  Could pydtrace.h not be included in 
/Include so that it is always created at build time in 
/Include?   If PyEval_GetFrame() were passed via function__entry then 
stap would be able to do something akin to what the ustack helper phelper.d is 
doing.

--
nosy: +scox

___
Python tracker 
<http://bugs.python.org/issue13405>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com