An extension for collecting and viewing performance profiles directly in VSCode.
Performance Profile Viewer is an extension for collecting and viewing performance profiles directly in VSCode. It can open profiles from GProf, PyInstrument, CProfile, HPCToolkit, Caliper, Tau, Score-P, Timemory, and raw JSON data. Currently, it supports a view of the call graph with run times and a flamegraph. NOTE: This extension requires the Python package hatchet to be installed. See Requirements for more info.
Open profiles using the command Profile: Open Profile
(CTRL+SHIFT+P or
CMD+SHIFT+P to start commands).
You will be asked for the type of profile and path to the profile.
Then it will open in a tree and flamegraph view as shown below.
Both of the views are dynamic. You can click around, explore the data, and even jump directly to the corresponding source code locations.
Launching the different profilers for your programs is provided through VSCode
tasks.
For instance, define tasks in your tasks.json
similar to the PyInstrument
example below to set up profiler launching directly in VSCode.
See the Profiling Documentation for more details.
{
"type": "PyInstrument",
"program": "main.py",
"args": ["--foo"],
"outputPath": "${workspaceFolder}/profile.json"
}
Performance Profile Viewer uses the Python library
Hatchet
to parse and process the different profile types.
You must install it in order to use the extension.
Currently, the extension has been tested with Hatchet version 1.3.1 to 1.4.0
and Python 3.8 to 3.12.
Assuming there is a valid Python installation, then it can be installed with
pip install hatchet==1.4.0
.
profileviewer.animatedHotPathIcons
[boolean] (default:false
) -- animate the icons that display the hot path along the treeprofileviewer.pythonPath
[string] -- manually provide the path to the Python executable that has hatchet installed; otherwise the extension will try to find it automatically
Issues can be submitted under the issues tab on GitHub.
- add export and import
- clean up documentation
- add task definitions to run PyInstrument, cProfile, and HPCToolkit
- added documentation for tasks
- separate commands for opening tree, flamegraph, and both
- added setting to manually specify Python and hatchet path
- better error checking for Python and hatchet versions in environment
- cache environment information, so it's faster to open profiles
- Hotfix for missing HTML file
- Hotfix for missing Python script
- updated logo
- fancy hot path icons
- added licensing information
- better error messages
- Added show hot path button.
- Added support to open raw JSON data.
Initial release.
- Support for profiles from GProf, PyInstrument, CProfile, HPCToolkit, Caliper, Tau, Score-P, Timemory, and raw JSON data.
- Call tree viewer
- Flamegraph viewer
Copyright Daniel Nichols 2024
Performance Profile Viewer is published under the Apache 2.0 license. The flamegraph view uses d3-flame-graph, which is published under the Apache 2.0 license. Hatchet is published under the MIT license.