Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
"""Example python3 application that uses HawkTracer tracing system.
This application demonstrates how to instrument python3 code to measure
execution time of a specific function.
This is the simplest example. In order to enable tracing, it needs to be run
with HT_PYTHON_TRACE_ENABLED=1 environment variable. If the env variable is unset,
tracing is disabled and no overhead is introduced.
from hawktracer.core import trace, register_file_listener
def foo():
print("This is foo.")
print("This function is traced!.")
def bar():
print("This is bar.")
print("This function isn't traced, as it doesn't have @trace decorator.")
def foobar():
print("This is foobar")
print("This function is also traced!")
register_file_listener("test.htdump", 1024*1024);
for i in range(10):