Example useCreating a traceTo use the tracer, just run pytracefile.py with a Python source. For example, lets look at test.py: import time
def g():
time.sleep(0.1)
print 'g'
def f():
for i in xrange(10):
g()
if __name__ == '__main__':
f()Lets run it: $ python test.py
g
g
g
g
g
g
g
g
g
g To get a trace, we can just run: $ pytracefile.py test.py
g
g
g
g
g
g
g
g
g
g This will create or overwrite a profile/trace output file called "profile.out". You can rename this to whatever you wish, but there is currently no way to control the output filename from pytracefile.py itself. Note: The python paths are not currently fixed in accordance with normal script running, so you may need to use PYTHONPATH= <scriptpath> pytracefile.py .... in order for it to run correctly. Viewing a traceTo view the trace, we can run: $ pytracefile.py -v profile.out which results in a Gtk+ trace viewer that looks like: It is possible to have the viewer automatically be spawned immediately when the trace is complete. See pytracefile.py --help for more details.
|
How can I solve this error?
sander@fujitsu:~/usr/bin$ python hello-world.py Hello, World!
sander@fujitsu:~/usr/bin$ ./pytracefile.py python hello-world.py Traceback (most recent call last):
ImportError?: No module named pytracer sander@fujitsu:~/usr/bin$Sanders: Did you try the new release? Do you still get that error?
Hi,, Recently tested pytrace on netbsd., please explain this error?
pytracefile.py -v profile.out Traceback (most recent call last):
graphfile.Error: graphfile_reader_init