-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Generate event specific reports (#32)
This PR makes it possible to aggregate the runtime of event listeners for all fired Sphinx events. Tricky part in pyinstrument is that all event listeners appear under `EventManager.emit`, so the event name is lost. The PR monkeypatches Sphinx to use a custom Event listener which injects an event specific `emit` function, so it can be tracked in pyinstrument. The PR can be tested with `sphinx-analysis --project needs --pyinstrument --tree`. A new JSON report of name `pyinstrument_sphinx_events.json` is created. It contains all unique combinations of file path, class and function of all event listeners, so it will pick up all extensions that have listeners registered. The dictionary `sphinx_performance/sphinx_events.py:CUSTOM_FRAMES_BY_EVENT` can be modified to add more frames of interest (unrelated to events). It is currently used to track the runtime of `sphinxcontrib-plantuml`. The generated JSON file can be used for 2 purposes: - As a support to the pyinstrument HTML report to get a per-event aggregation - To run in a CI and check how a PR to Sphinx or an extension affects performance The HTML report now contains event specific function names, so event names can be searched.
- Loading branch information
Showing
18 changed files
with
659 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This project is for developing the sphinx-performance extension itself. | ||
It registeres to all known Sphinx events and the listener just waits a while. | ||
That way all events appear in the output tree with a significant runtime. |
Oops, something went wrong.