From 9e3d3e0532444c46a907128560cdad31888dcdea Mon Sep 17 00:00:00 2001 From: Angelos Evripiotis Date: Tue, 5 Feb 2019 14:54:15 +0000 Subject: contributing: snakeviz replaces pyflame+flamegraph Replace the instructions for pyflame+flamegraph with simpler ones for snakeviz. For our general use-case this seems to be easier and better. Usage of this tool was demonstrated at the 2019 BuildStream Gathering in January by Daniel Silverstone, when presenting the aggregate results of profiling on many target environments. Here is the relevant mailing list thread: "Profiling before the gathering" https://mail.gnome.org/archives/buildstream-list/2019-January/msg00057.html --- CONTRIBUTING.rst | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 815acfca6..b993b08b6 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -1707,26 +1707,13 @@ You can then analyze the results interactively using the 'pstats' module: For more detailed documentation of cProfile and 'pstats', see: https://docs.python.org/3/library/profile.html. -For a richer visualisation of the callstack you can try `Pyflame -`_. Once you have followed the instructions in -Pyflame's README to install the tool, you can profile `bst` commands as in the -following example: +For a richer and interactive visualisation of the `.cprofile` files, you can +try `snakeviz `_. +You can install it with `pip install snakeviz`. Here is an example invocation: - pyflame --output bst.flame --trace bst --help - -You may see an `Unexpected ptrace(2) exception:` error. Note that the `bst` -operation will continue running in the background in this case, you will need -to wait for it to complete or kill it. Once this is done, rerun the above -command which appears to fix the issue. - -Once you have output from pyflame, you can use the ``flamegraph.pl`` script -from the `Flamegraph project `_ -to generate an .svg image: - - ./flamegraph.pl bst.flame > bst-flamegraph.svg - -The generated SVG file can then be viewed in your preferred web browser. + snakeviz bst.cprofile +It will then start a webserver and launch a browser to the relevant page. Profiling specific parts of BuildStream with BST_PROFILE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.1