forked from microsoft/vscode-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Add live profiling support with flame graph visualization #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Copilot
wants to merge
7
commits into
main
Choose a base branch
from
copilot/add-live-profiling-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or 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
- Add profiling commands (Start/Stop Profiling) with record/stop icons - Create profiling service for DAP communication - Implement profile data aggregator with weighted tree - Create profile viewer manager with embedded webview - Add profiling event handler for DAP custom events - Register profiling services in debugger service registry - Add profiling buttons to debug toolbar - Install React and react-flame-graph dependencies - Update icon to use "record" icon for start profiling button Co-authored-by: vilterp <7341+vilterp@users.noreply.github.com>
- Add handleTerminateEvent to close profile viewers when debug session ends - Create comprehensive unit tests for ProfileDataAggregator - Fix frame iteration order to build correct flame graph (bottom-to-top) - Fix function table aggregation to properly sum self/total counts - Fix percentage calculation to happen after all data is collected - All 7 profiling tests now passing Co-authored-by: vilterp <7341+vilterp@users.noreply.github.com>
- Create detailed README explaining architecture and components - Add quick start guide for users (PROFILING_USAGE.md) - Include example Python script for testing (profiling_demo.py) - Document DAP protocol, data flow, and interpretation - Add troubleshooting tips and best practices Co-authored-by: vilterp <7341+vilterp@users.noreply.github.com>
- Create detailed UI layout specification (PROFILING_UI.md) - Add comprehensive implementation summary - Document all files created and modified - Provide testing instructions and success criteria - Include architecture diagrams and design decisions Co-authored-by: vilterp <7341+vilterp@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add live profiling support to VSCode Python extension
Add live profiling support with DAP integration
Feb 3, 2026
- Create DEBUGPY_SETUP.md with 3 methods for installing custom debugpy - Document Method 1: Install in Python environment (recommended) - Document Method 2: Use debugAdapterPath in launch.json (advanced) - Document Method 3: Build custom ms-python.debugpy extension (expert) - Add troubleshooting section with common issues and solutions - Include platform-specific notes (Windows, macOS, Linux, Docker) - Update PROFILING_USAGE.md with quick setup and link to guide - Update IMPLEMENTATION_SUMMARY.md to reference new documentation - Update profiling README.md with documentation index Co-authored-by: vilterp <7341+vilterp@users.noreply.github.com>
Copilot
AI
changed the title
Add live profiling support with DAP integration
Add documentation for using custom debugpy versions
Feb 3, 2026
- Add "How debugpy is Resolved" section explaining priority order - Clarify that ms-python.debugpy checks environment BEFORE bundled version - Add "Understanding debugpy Resolution Order" section with detailed explanation - Emphasize that installing in venv/virtualenv takes priority automatically - Add FAQ section answering "Does the debugpy extension check my virtual environment first?" (YES!) - Add verification steps to confirm which debugpy is being used - Update Method 1 explanation with "Why This Works" subsection - Make it crystal clear that environment debugpy has priority over bundled version This directly answers the user's question: "So the vscode python extension (or the debugpy extension it uses) looks for a version of debugpy in the debugee's virtual environment, before falling back to its own internal version?" - YES, it does! Co-authored-by: vilterp <7341+vilterp@users.noreply.github.com>
Copilot
AI
changed the title
Add documentation for using custom debugpy versions
Document debugpy resolution order and custom installation methods
Feb 3, 2026
Copilot
AI
changed the title
Document debugpy resolution order and custom installation methods
Add live profiling support with flame graph visualization
Feb 3, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements live profiling for Python debug sessions, consuming the profiling API from debugpy via DAP custom requests/events.
Dependent on vilterp/debugpy#1
Implementation
Core profiling flow:
ProfilingServicesendsstartProfiling/stopProfilingDAP requestsProfilingEventHandlerreceivesprofilingSamplesevents, routes to aggregatorProfileDataAggregatorbuilds weighted call tree incrementally from stack samplesProfileViewerManagerrenders webview with flame graph and sortable function tableUI integration:
Architecture:
Files Added
Implementation (6 TypeScript services, 837 lines):
profilingService.ts- DAP communication layerprofileDataAggregator.ts- Weighted tree builderprofileViewerManager.ts- Webview lifecycle + embedded HTML/CSS/JSprofilingEventHandler.ts- Event routingprofilingCommands.ts- Command registrationtypes.ts- Type definitionsTests:
profileDataAggregator.unit.test.ts- 7 tests covering aggregation logic (100% passing)Documentation:
PROFILING_USAGE.md- User guidePROFILING_UI.md- UI specificationDEBUGPY_SETUP.md- Custom debugpy installation (3 methods: environment install, launch.json path, custom extension)IMPLEMENTATION_SUMMARY.md- Architecture overviewprofiling_demo.py- Test scriptConfiguration Changes
package.json- Commands, debug toolbar menu contributions, React dependenciesserviceRegistry.ts- DI registration for profiling servicesconstants.ts,commands.ts- Command definitions and type mappingsdebugpy Resolution Order
Documentation clarifies that
ms-python.debugpychecks the active Python environment for debugpy before using its bundled version:debugAdapterPathin launch.json (highest priority)import debugpy)This means
pip install git+https://github.com/vilterp/debugpy.git@profiling-supportin a venv automatically takes priority - no configuration needed.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.