Skip to content

Dando18/performance-profile-viewer-vscode

Repository files navigation

Performance Profile Viewer

An extension for collecting and viewing performance profiles directly in VSCode.

Visual Studio Code Visual Studio Marketplace Downloads GitHub release (with filter) GitHub license GitHub Workflow Status (with event) codecov

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.

Features

Viewing Performance Profiles

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.

Opening Profile

Both of the views are dynamic. You can click around, explore the data, and even jump directly to the corresponding source code locations.

Exploring Tree View

Exploring FlameGraph View

Collecting Profiling Data

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"
}

Requirements

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.

Extension Settings

  • profileviewer.animatedHotPathIcons [boolean] (default: false) -- animate the icons that display the hot path along the tree
  • profileviewer.pythonPath [string] -- manually provide the path to the Python executable that has hatchet installed; otherwise the extension will try to find it automatically

Known Issues

Submitting Issues

Issues can be submitted under the issues tab on GitHub.

Release Notes

0.1.2

  • add export and import
  • clean up documentation

0.1.1

0.1.0

  • 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

0.0.5

  • Hotfix for missing HTML file

0.0.4

  • Hotfix for missing Python script

0.0.3

  • updated logo
  • fancy hot path icons
  • added licensing information
  • better error messages

0.0.2

  • Added show hot path button.
  • Added support to open raw JSON data.

0.0.1

Initial release.

License

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.