Code Monkey home page Code Monkey logo

2kai2kai2 / vscode-python-resource-monitor Goto Github PK

View Code? Open in Web Editor NEW
16.0 4.0 5.0 5.77 MB

A Visual Studio Code extension for viewing resource consumption of Python programs in the debugger.

Home Page: https://marketplace.visualstudio.com/items?itemName=kaih2o.python-resource-monitor

License: GNU General Public License v3.0

TypeScript 33.41% HTML 5.31% JavaScript 60.79% Python 0.48%
resource-monitor python cpu debuggers monitor vscode vscode-extension visual-studio-code visualstudiocode performance-monitoring performance-visualization process memory

vscode-python-resource-monitor's Introduction

GitHub Version Published Version Installs Last Updated Donate

Python Resource Monitor

Until now, resource and performance monitor extensions in VS Code only displayed current global resource consumption data via lists and text. Likewise, it is very awkward to use third-party tools to find the process you want to monitor.

However, this extension provides an easier, graphical solution that can show data specific to the process being used by the Python debugger! Yeah, so I made this because searching for the right Python process in Task Manager was annoying.

Features

Provides a resource monitor that is opened when debugging Python, including process memory, cpu usage, and file usage. Automatically launches (or reuses existing tab) upon debugging with Python.

usage

Test program storing strings of random sizes in memory

Uses theme colors

usage2

Customizable

Command Usage
PyRSM: Length Set the maximum log length in milliseconds of the resource monitor. Set to 0 to allow unlimited length (time display will scale).
PyRSM: Polling Interval Set the time between datapoints in milliseconds.

Known Issues and Future Updates

  • Hopefully, this will one day work for many languages and debuggers!
  • MacOS tends to allocate an extremely large amount of virtual memory, which can cause memory usage to appear inaccurate.
  • Response to mouseover of the graph.

vscode-python-resource-monitor's People

Contributors

2kai2kai2 avatar dependabot[bot] avatar mgrunbauer avatar nlaha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vscode-python-resource-monitor's Issues

Cannot install on MacOS with M1 chip

Hi, thank you for looking at the installation issue #7!

Running the v0.2.2 release under MacOS with an M1 chip (arm64), results in the following error:

2023-06-05 16:21:12.043 [error] Activating extension kaih2o.python-resource-monitor failed due to an error:
2023-06-05 16:21:12.043 [error] Error: No native build was found for platform=darwin arch=arm64 runtime=electron abi=110 uv=1 armv=8 libc=glibc node=16.17.1 electron=22.5.2
    loaded from: /Users/myuser/.vscode/extensions/kaih2o.python-resource-monitor-0.2.2/node_modules/node-ps-data

I've checked the $extension/node_modules/node-ps-data/prebuilds directory and I see it now contains builds for darwin-x64, linux-x64 and win32-x64.

Would it be possible to also include a build for darwin-arm64?

Performing the "manual installation steps" as outlined in #7 (referencing a locally build node-ps-data) still works as a work-around.

I'm not familiar with github runners, but it might not be possible until this github roadmap issue will be picked up.

CPU Usage not showing

Not sure whether its due to my platform specifically but CPU usage line is never there while running the program, but as soon as I close it, the line reappears and so on. I'm on ryzen 5 3600, no real other idea on what it could be.
image
image

How to use it ??

Hi, I think this is a nice tool, but I don't know how to use it

monitoring screen does not appear on the python debug page.

Are there any other settings required?

PyRSM not opening when launching with debug.

No matter what I tried, I can't seem to be able to use PyRSM.
I tried changing the "type" to "python" instead of "debugpy".
I tried reinstalling it. Yet nothing worked.

Hardware:
Macbook Pro M1 13' 8Gb RAM 512 Gb SSD.

UX (size and visibility)

Hi, and thanks for the great work.

I'm interested in having this Extention installed and I'd suggest the following features for improving user experience:

  1. Make it remember the window size
    Currently, it would change its window size randomly and likes to take half of the screen width by default
  2. Add a feature to toggle its visibility (Activate/Deactivate) using an icon at the bottom bar, a toggle button on the GUI page or fast commands to trigger in the command palette.

Kind regards

Incorrect memory usage

Hey,

I noticed a couple of potential bugs in the profiler and wanted to bring them to your attention :)

It seems the profiler is showing incorrect memory usage. I have 64GB RAM on my system but the profiler tells me I am consuming 128 GB (Not shown in the screenshot). This might also be due to me using multiprocessing, but I am not sure.

Also, the monitored PIDs from previous debug runs are still being displayed in new runs.
I also noticed that "Write Usage" displays nothing at all, even though I am writing to disk.

grafik

Best,
Karol

Not Launching

Hi, I have installed this on windows and linux computers and it will not launch when i debug python program, can you please advise.
Thank you

[Feature request] Video memory usage

Hello! Please add video memory usage! nvidia-smi provides info. For coding with Pytorch and Tensorflow using CUDA we need this info!
Thanks very much.

Add debugger TreeView option for UI

Currently we pop open a new editor pane for the resource monitor. However, this can be somewhat intrusive, so we should add support for putting it in a new TreeView, which will essentially add the resource monitor as a dropdown in the debugger tab.

Extension fails to load, unable to install node-ps-data

Hello, when installing the extension (v0.2.0) from the marketplace and starting a debug session, the extension does not show up.

Mac OS 13.3.1 with Apple M1 chip

Output from "Extension Host" logging shows it cannot install node-ps-data:

Output from `Output > Extension Host` logging

2023-04-29 19:36:21.524 [error] Activating extension kaih2o.python-resource-monitor failed due to an error:
2023-04-29 19:36:21.524 [error] Error: Cannot find module 'node-ps-data'
Require stack:
- /Users/myusername/.vscode/extensions/kaih2o.python-resource-monitor-0.2.0/out/extension.js
- /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js
- /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js
- /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-fork.js
- 
	at Module._resolveFilename (node:internal/modules/cjs/loader:987:15)
	at i._resolveFilename (node:electron/js2c/utility_init:17:840)
	at Module._load (node:internal/modules/cjs/loader:832:27)
	at c._load (node:electron/js2c/asar_bundle:5:13343)
	at m._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:124:14199)
	at h._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:119:11871)
	at I._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:119:11264)
	at Module.require (node:internal/modules/cjs/loader:1059:19)
	at g (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:4:647)
	at Object.<anonymous> (/Users/myusername/.vscode/extensions/kaih2o.python-resource-monitor-0.2.0/out/extension.js:14:12)
	at u._compile (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:4:1271)
	at Module._extensions..js (node:internal/modules/cjs/loader:1220:10)
	at Module.load (node:internal/modules/cjs/loader:1035:32)
	at Module._load (node:internal/modules/cjs/loader:876:12)
	at c._load (node:electron/js2c/asar_bundle:5:13343)
	at m._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:124:14199)
	at h._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:119:11871)
	at I._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:119:11264)
	at Module.require (node:internal/modules/cjs/loader:1059:19)
	at require (node:internal/modules/cjs/helpers:102:18)
	at Function.i [as __$__nodeRequire] (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:5:98)
	at E.rb (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:119:13135)
	at async Promise.all (index 0)

Manually running npm install reveals it is missing a header file:

Output of `npm install`

myusername@myusername-mbp kaih2o.python-resource-monitor-0.2.0 % npm install
npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated [email protected]: This package has been renamed to @vscode/test-electron, please update to the new name
npm ERR! code 1
npm ERR! path /Users/myusername/.vscode/extensions/kaih2o.python-resource-monitor-0.2.0/node_modules/node-ps-data
npm ERR! command failed
npm ERR! command sh -c node-gyp-build
npm ERR! CXX(target) Release/obj.target/node_ps_data/napi.o
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info find Python using Python version 3.11.3 found at "/opt/homebrew/opt/[email protected]/bin/python3.11"
npm ERR! gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.11
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/Users/myusername/.vscode/extensions/kaih2o.python-resource-monitor-0.2.0/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/myusername/.vscode/extensions/kaih2o.python-resource-monitor-0.2.0/node_modules/node-ps-data/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/myusername/.vscode/extensions/kaih2o.python-resource-monitor-0.2.0/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/myusername/Library/Caches/node-gyp/19.9.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/Users/myusername/Library/Caches/node-gyp/19.9.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/Users/myusername/.vscode/extensions/kaih2o.python-resource-monitor-0.2.0/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/myusername/Library/Caches/node-gyp/19.9.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/myusername/.vscode/extensions/kaih2o.python-resource-monitor-0.2.0/node_modules/node-ps-data',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! ../napi.cc:2:10: fatal error: 'napi.h' file not found
npm ERR! #include <napi.h>
npm ERR!          ^~~~~~~~
npm ERR! 1 error generated.
npm ERR! make: *** [Release/obj.target/node_ps_data/napi.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/Users/myusername/.vscode/extensions/kaih2o.python-resource-monitor-0.2.0/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Darwin 22.4.0
npm ERR! gyp ERR! command "/opt/homebrew/Cellar/node/19.9.0/bin/node" "/Users/myusername/.vscode/extensions/kaih2o.python-resource-monitor-0.2.0/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /Users/myusername/.vscode/extensions/kaih2o.python-resource-monitor-0.2.0/node_modules/node-ps-data
npm ERR! gyp ERR! node -v v19.9.0
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in: /Users/myusername/.npm/_logs/2023-04-29T18_06_26_341Z-debug-0.log

However I can manually compile node-ps-data. So I can get the extension to work by:

  • Manually cloning node-ps-data from github
  • Running npm install from node-ps-data
  • Editing the package.json from python-resource-monitor to use local directory:
"node-ps-data": "file:///Users/myusername/src/node-ps-data"

  • Running npm install from python-resource-monitor
  • Close and open VS Code and start debugging.

Any thoughts?

PS. after working around the installation issues, the plugin does show up in vs code when debugging on MacOS :). It shows very high memory values (>300 GB) but that might be a different issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.