Merge branch 'deathgrippin-profiling-patch'

This commit is contained in:
Andrew David Wong 2020-06-04 08:14:31 -05:00
commit cd20bfc447
No known key found for this signature in database
GPG Key ID: 8CE137352A019A17

View File

@ -11,7 +11,7 @@ redirect_from:
Profiling Profiling
========= =========
This is python profiling primer. This is a python profiling primer.
For the purpose of this document, `qubes-dev` is name of the domain used for postprocessing profiling stats. For the purpose of this document, `qubes-dev` is name of the domain used for postprocessing profiling stats.
@ -23,7 +23,7 @@ yum install gprof2dot graphviz
git clone http://git.woju.eu/qubes/profiling.git git clone http://git.woju.eu/qubes/profiling.git
~~~ ~~~
If you profile something on dom0, move `Upload.sh` from repository to dom0: If you profile something in dom0, move `Upload.sh` from the repository to dom0:
~~~ ~~~
mkdir -p ~/profiling mkdir -p ~/profiling
@ -37,7 +37,7 @@ Workflow
### Identify function responsible for some slow action ### Identify function responsible for some slow action
You have to select area in which you suspect less than optimal performance. If you do not narrow the area, graphs may be unreadable. You have to select the area in which you suspect less than optimal performance. If you do not narrow the area, graphs may be unreadable.
### Replace suspect function with probe ### Replace suspect function with probe
@ -59,7 +59,7 @@ with
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. 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. Remember to revert your changes to the application afterwards.
### Upload statistics ### Upload statistics
@ -76,13 +76,13 @@ cd ~/profiling
make 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`. For every `${basename}.pstats` this will produce `${basename}.txt` and `${basename}.svg`. SVG files contain call graphs. Text files contain lists of all functions, sorted by cumulative execution time. You may also try `make all-png`.
~~~ ~~~
make index.html make index.html
~~~ ~~~
This creates `index.html` with all SVG graphics linked to TXT files. Ready for upload. This creates `index.html` with all SVG graphics linked to TXT files, ready for upload.
~~~ ~~~
make REMOTE=example.com:public_html/qubes/profiling/ upload make REMOTE=example.com:public_html/qubes/profiling/ upload
@ -95,4 +95,4 @@ This example is from `qubes-manager` (`qubesmanager/main.py`).
!["update\_table-20140424-170010.svg"](//attachment/wiki/Profiling/update_table-20140424-170010.svg) !["update\_table-20140424-170010.svg"](//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. It is apparent that the problem is around `get_disk_usage`, which calls something via `subprocess.call`. It does this 15 times, probably once per VM.