gaogaotiantian / viztracer

VizTracer is a low-overhead logging/debugging/profiling tool that can trace and visualize your python code execution.
https://viztracer.readthedocs.io/
Apache License 2.0
5.01k stars 375 forks source link

command not found: vizviewer #366

Closed amir-viva closed 5 months ago

amir-viva commented 1 year ago

I ran the following script:

python3 my_file.py What's in the terminal ?

Loading finish                                        
Total Entries: 9                                                                
Use the following command to open the report:
vizviewer /home/amir/test/viztrace_/optional.json

JSON is generated successfully . When I ran the following command. vizviewer --once optional.json

But, I got the following error: zsh: command not found: vizviewer

I am using Ubuntu. And the viztracer installation folder contains:

Sorry , I search for the issue here and there for my problem. And didn't find a solution. So that I created a issue here. Would you please help me anyone?

P.S.: I need this to trace the nested function execution in my FastAPI app.

gaogaotiantian commented 1 year ago

Did you install viztracer through pip? Can you do viztracer your_script.py command in command line? What about python3 -m viztracer your_script.py? Seems like an incorrect installation. Did you use virtual environment?

amir-viva commented 1 year ago

I didn't use virtual environment. I install directly in my machine through pip

gaogaotiantian commented 1 year ago

You should be able to use the command viztracer in your terminal, otherwise it's an installation issue. If you are using inline tracer and you can somehow use it with python3, then python3 -m viztracer should work. In that case, you may be able to use python3 -m viztracer.viewer result.json.

If you only need the call stack, not the source file with it, you can always use https://ui.perfetto.dev to load your json file.

amir-viva commented 1 year ago

Thanks for your response. I want another help from you. I just want to trace only , my hand written code. I don't want to trace the whole , lib-package / site-packages.

How to configure it ? I am using inline tracing with context manager

gaogaotiantian commented 1 year ago

Check out --include_files and --exclude_files options. It will introduce extra overhead for profiling though.