2kai2kai2 / VSCode-Python-Resource-Monitor

A Visual Studio Code extension for viewing resource consumption of Python programs in the debugger.
https://marketplace.visualstudio.com/items?itemName=kaih2o.python-resource-monitor
GNU General Public License v3.0
17 stars 5 forks source link

Support python multiprocessing, split io graphs #8

Closed mgrunbauer closed 1 year ago

mgrunbauer commented 1 year ago

Is this project open to pull requests? I have added support for python multiprocessing and would like to hear your thoughts/feedback.

Currently, the panel extension gets disposed and recreated on every new pid and you cannot see the pids together in the graphs. This makes the extension not very usable when debugging a program that uses multiprocessing.

I've tested this on Linux and Mac OS with a python program that spawns multiple processes. All the spawned processes get monitored and data is shown in a different color. Colors are taken from the terminal styling. The color is unique per pid, colors get reused after 12 processes. If you run a python program with only a single process, it will just use the color ansiGreen, so the default extension behavior stays the same.

Demo

Demo gif with multiprocessing The colors seem to be flashing, this is not visible in VS Code for me. ![multiprocessing](https://user-images.githubusercontent.com/40422392/235362990-ba301eff-4fc1-4c03-a05e-79bb7bbbeaff.gif)

Changes:

extension.js:

panel.js: