python tapset

Stan Cox scox@redhat.com
Thu Nov 17 21:53:00 GMT 2011


This is a first cut at a tapset that enables probing python applications.
  python_backtrace - get backtraces for the running python application
  python_get_variable [VARIABLE] - get value of a running python
         application variable.  VARIABLE can be a variable wildcard,
         aotherwise defaults to *

# python-backtrace example
stap -I tapset -g -c '/usr/local/bin/python ./celsius.py 30' celsius-bt.stp
#0 celsius_to_farenheit (celsius:int ) at ./celsius.py:7
#1 main  at ./celsius.py:19
#2 <module>  at ./celsius.py:3
...

# python-get_variable examples
stap -I tapset -g -c '/usr/local/bin/python ./celsius.py 30' celsius-var.stp
  global str __builtins__ in <module> at ./celsius.py
  global str __name__ in <module> at ./celsius.py = "__main__"
  global str __file__ in <module> at ./celsius.py = "./celsius.py"
int celsius in main at ./celsius.py = 30
tuple atuple in celsius_to_farenheit at ./celsius.py =  "a", "b", "c",
list alist in celsius_to_farenheit at ./celsius.py = [ 1, 2, 3,]
set aset in celsius_to_farenheit at ./celsius.py = { 1, 2, 3,}
dict adict in celsius_to_farenheit at ./celsius.py = { 1:"a" 2:"b" 3:"c" }
int nine in celsius_to_farenheit at ./celsius.py = 9
int five in celsius_to_farenheit at ./celsius.py = 5
int thirty_two in celsius_to_farenheit at ./celsius.py = 32
int i in celsius_to_farenheit at ./celsius.py = 1

stap -I tapset -g -c '/usr/local/bin/python ./celsius.py 30' 
celsius-var.stp 'ni*'
int nine in celsius_to_farenheit at ./celsius.py = 9

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: celsius.py
URL: <http://sourceware.org/pipermail/systemtap/attachments/20111117/36557831/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: python.diff
URL: <http://sourceware.org/pipermail/systemtap/attachments/20111117/36557831/attachment-0001.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: python.stp
URL: <http://sourceware.org/pipermail/systemtap/attachments/20111117/36557831/attachment-0002.ksh>


More information about the Systemtap mailing list