Skip to content

Commit

Permalink
Adds PyInstrument (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
danwos committed Oct 31, 2022
1 parent f91f8f9 commit 2c4210a
Show file tree
Hide file tree
Showing 8 changed files with 492 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -35,3 +35,4 @@ results.csv

*.html
*.prof
*.json
Binary file added docs/_static/pyinstrument_tree.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions docs/cli.rst
Expand Up @@ -180,6 +180,14 @@ is the used **memory profiler**, which also supports a live viewer.
The options for setting up the project are the same as for :ref:`sphinx-performance`, except
``csv``, which is not supported, and ``snakeviz``, which was renamed to ``flamegraph``.

Example calls::

sphinx-analysis --project --pages 10 --folders 3 --depth 2 --memray --flamegraph
sphinx-analysis --project --pages 10 --folders 3 --depth 2 --runtime --stats
sphinx-analysis --project needs --needs 40 --needtables 2 --pages 5 --folders 2 --depth 1 --pyinstrument --tree



.. _option_runtime:

\-\-runtime
Expand All @@ -206,6 +214,13 @@ A memray viewer can be opened in another terminal by executing ``memray live 131
.. image:: /_static/sphinx_analysis_live.gif
:width: 99%

.. _option_pyinstrument:

\-\-pyinstrument
~~~~~~~~~~~~~~~~
Uses the pyinstrument profiler and saves the profile in a file called ``pyinstrument_profile.json``.


\-\-stats
~~~~~~~~~
Prints some statistics at the end of the build.
Expand Down Expand Up @@ -258,3 +273,16 @@ Can be used to answer questions to the user automatically with ``yes``.

This may happen, if e.g. multiple projects are configured to be used, and ``sphinx-analysis`` asks the user to confirm
this.


\-\- tree
~~~~~~~~~
Creates a ``pyinstrument_profile.html`` file, which shows a runtime tree, profiled by ``--pyinstrument``.

Supported by: :ref:`option_pyinstrument`.


.. figure:: /_static/pyinstrument_tree.png
:width: 49%

pyinstrument tree in HTML file
2 changes: 2 additions & 0 deletions docs/index.rst
Expand Up @@ -83,6 +83,8 @@ Changelog
~~~~~
:Released: under development

* Improvement: Adds :ref:`option_pyinstrument` as an additional profiler to :ref:`sphinx-analysis`.

0.1.7
~~~~~
:Released: 27.10.2022
Expand Down

0 comments on commit 2c4210a

Please sign in to comment.