Beware that some functions may be called often. For example `qubesmanager/main.py:update_table` gets run once per second. This will produce one pstat file per second.
Remember to revert your changes to application afterwards.
### Upload statistics
If you are in dom0:
``` {.wiki}
cd ~/profiling
./Upload.sh
```
### Analyse
``` {.wiki}
make
```
For every `${basename}.pstats` this will produce `${basename}.txt` and `${basename}.svg`. SVG contains call graph. Text file contains list of all functions sorted by cumulative execution time. You may also try `make all-png`.
``` {.wiki}
make index.html
```
This creates `index.html` with all SVG graphics linked to TXT files. Ready for upload.
``` {.wiki}
make REMOTE=example.com:public_html/qubes/profiling/ upload
This example is from `qubes-manager` (`qubesmanager/main.py`).
[![No image "update\_table-20140424-170010.svg" attached to Profiling](/chrome/common/attachment.png "No image "update_table-20140424-170010.svg" attached to Profiling")](/attachment/wiki/Profiling/update_table-20140424-170010.svg)
It is apparent than problem is around `get_disk_usage` which calls something via `subprocess.call`. It does it 15 times, probably once per VM.