... |
... |
@@ -1707,26 +1707,13 @@ You can then analyze the results interactively using the 'pstats' module: |
1707
|
1707
|
For more detailed documentation of cProfile and 'pstats', see:
|
1708
|
1708
|
https://docs.python.org/3/library/profile.html.
|
1709
|
1709
|
|
1710
|
|
-For a richer visualisation of the callstack you can try `Pyflame
|
1711
|
|
-<https://github.com/uber/pyflame>`_. Once you have followed the instructions in
|
1712
|
|
-Pyflame's README to install the tool, you can profile `bst` commands as in the
|
1713
|
|
-following example:
|
|
1710
|
+For a richer and interactive visualisation of the `.cprofile` files, you can
|
|
1711
|
+try `snakeviz <http://jiffyclub.github.io/snakeviz/#interpreting-results>`_.
|
|
1712
|
+You can install it with `pip install snakeviz`. Here is an example invocation:
|
1714
|
1713
|
|
1715
|
|
- pyflame --output bst.flame --trace bst --help
|
1716
|
|
-
|
1717
|
|
-You may see an `Unexpected ptrace(2) exception:` error. Note that the `bst`
|
1718
|
|
-operation will continue running in the background in this case, you will need
|
1719
|
|
-to wait for it to complete or kill it. Once this is done, rerun the above
|
1720
|
|
-command which appears to fix the issue.
|
1721
|
|
-
|
1722
|
|
-Once you have output from pyflame, you can use the ``flamegraph.pl`` script
|
1723
|
|
-from the `Flamegraph project <https://github.com/brendangregg/FlameGraph>`_
|
1724
|
|
-to generate an .svg image:
|
1725
|
|
-
|
1726
|
|
- ./flamegraph.pl bst.flame > bst-flamegraph.svg
|
1727
|
|
-
|
1728
|
|
-The generated SVG file can then be viewed in your preferred web browser.
|
|
1714
|
+ snakeviz bst.cprofile
|
1729
|
1715
|
|
|
1716
|
+It will then start a webserver and launch a browser to the relevant page.
|
1730
|
1717
|
|
1731
|
1718
|
Profiling specific parts of BuildStream with BST_PROFILE
|
1732
|
1719
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|