pytrace is a fast python tracer. it records function calls, arguments and return values. can be used for debugging and profiling.
C
449
121 commits
updated Apr 18, 2016
pytrace records function calls, arguments and return values.
traces aid debugging, profiling and obviate logging.
pytrace has been tested on python 2.7 and python 3.2. (should support 2.6 and up)
pytrace has been tested on os x and several linux distributions.
Follow @alonhorev on twitter for updates.
pytrace depends on sqlite and a C implementation of protocol buffers.
on debian/ubuntu: sudo apt-get install libsqlite3-dev libprotobuf-c0-dev
on fedora: sudo yum install libsqlite3x-devel sqlite-devel python-devel protobuf-c-devel
on mac (sqlite is included): brew install protobuf-c or port install protobuf-c
install pytrace:
pip install pytrace
Invoke pytrace with your script:
$ pytrace foo.py --bar
Invoke the reader from the same directory by executing pytrace with no arguments:
$ pytrace
The reader can be invoked while the script is running. providing 'online' debugging capabilities.
The collected data can be viewed in an interactive reader. The reader supports less-like key bindings.

The reader can search for regular expressions:

The reader can filter traces using a python expressions. The following fields can be used for filters:
Field types:
time > '2012/08/15 01:23:45'.module == 'proj%' filters modules starting with 'proj'.
The reader corrects queries that don't match anything:

The database is saved in the current working directory and is named traces.sqlite.
In order to not run out of disk space, The database will be truncated to a fixed number of traces (currently hard coded to 10000).
Hot functions can be skipped using a decorator:
from pytrace import notrace
@notrace
def hot():
pass
Trace specific packages:
$ export TRACE_MODULES=/Users/alon/project
You can specify a colon : separated list of folders as well.
pytrace can be broken down to three parts:
The separation of trace generation and dumping has several advantages:
C
53.5%
Python
45.9%
pytrace is a fast python tracer. it records function calls, arguments and return values. can be used for debugging and profiling.
C
449
121 commits
updated Apr 18, 2016
pytrace records function calls, arguments and return values.
traces aid debugging, profiling and obviate logging.
pytrace has been tested on python 2.7 and python 3.2. (should support 2.6 and up)
pytrace has been tested on os x and several linux distributions.
Follow @alonhorev on twitter for updates.
pytrace depends on sqlite and a C implementation of protocol buffers.
on debian/ubuntu: sudo apt-get install libsqlite3-dev libprotobuf-c0-dev
on fedora: sudo yum install libsqlite3x-devel sqlite-devel python-devel protobuf-c-devel
on mac (sqlite is included): brew install protobuf-c or port install protobuf-c
install pytrace:
pip install pytrace
Invoke pytrace with your script:
$ pytrace foo.py --bar
Invoke the reader from the same directory by executing pytrace with no arguments:
$ pytrace
The reader can be invoked while the script is running. providing 'online' debugging capabilities.
The collected data can be viewed in an interactive reader. The reader supports less-like key bindings.

The reader can search for regular expressions:

The reader can filter traces using a python expressions. The following fields can be used for filters:
Field types:
time > '2012/08/15 01:23:45'.module == 'proj%' filters modules starting with 'proj'.
The reader corrects queries that don't match anything:

The database is saved in the current working directory and is named traces.sqlite.
In order to not run out of disk space, The database will be truncated to a fixed number of traces (currently hard coded to 10000).
Hot functions can be skipped using a decorator:
from pytrace import notrace
@notrace
def hot():
pass
Trace specific packages:
$ export TRACE_MODULES=/Users/alon/project
You can specify a colon : separated list of folders as well.
pytrace can be broken down to three parts:
The separation of trace generation and dumping has several advantages:
C
53.5%
Python
45.9%