Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,12 @@

epub_author = 'Python Documentation Authors'
epub_publisher = 'Python Software Foundation'
epub_exclude_files = ('index.xhtml', 'download.xhtml')
epub_exclude_files = (
'index.xhtml',
'download.xhtml',
'_static/tachyon-example-flamegraph.html',
'_static/tachyon-example-heatmap.html',
Comment on lines +442 to +443
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to include the examples for the EPUB build, so exclude them.

)

# index pages are not valid xhtml
# https://github.com/sphinx-doc/sphinx/issues/12359
Expand Down
10 changes: 8 additions & 2 deletions Doc/library/profiling.sampling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,10 @@ an interactive flame graph visualization::
The flame graph visualization shows call stacks as nested rectangles, with
width proportional to time spent. The sidebar displays runtime statistics,
GIL metrics, and hotspot functions.
:download:`Try the interactive example </_static/tachyon-example-flamegraph.html>`.

.. only:: html
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tells Sphinx to only include this link for the HTML build. So not for EPUB or any other builders like plaintext. We don't do PDF, but others might build that.

Unfortunately, it seems Sphinx only supports this at the top-level, which means the following link isn't indented like the figure text above. And the text is now a separate paragraph rather than part of the figure text.


`Try the interactive example <../_static/tachyon-example-flamegraph.html>`__.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we make this a regular link rather than use the download role, we (1) can see the served HTML file on the docs server and (2) the link shows up in normal text and not monospaced font.

Before:

image

After:

image


If no output file is specified, the profiler generates a filename based on
the process ID (for example, ``flamegraph.12345.html``).
Expand Down Expand Up @@ -952,7 +955,10 @@ can be expanded to show which bytecode instructions consumed time:
Expanding a hot line reveals the bytecode instructions executed, including
specialized variants. The panel shows sample counts per instruction and the
overall specialization percentage for the line.
:download:`Try the interactive example </_static/tachyon-example-heatmap.html>`.

.. only:: html

`Try the interactive example <../_static/tachyon-example-heatmap.html>`__.

Heatmaps are especially useful when you know which file contains a performance
issue but need to identify the specific lines. Many developers prefer this
Expand Down