I am aware that you can see the CPU usage inside the status section of your glitch project, how do I get it form inside the actual code though? Like I’m displaying it on my website’s dashboard, I want a variable to have the CPU percentage, how do I get that? This is my website that I’m gonna add it to http://karrot.js.org/
If you’re using NodeJS, you can use the
os module to detect CPU stack and usage and all that stuff.
Check out this link: https://nodejs.dev/learn/the-nodejs-os-module
On cloud repos, it seems like
os detects the cpu/storage of the entire server your project is on - in REPL.it my code returned 25gb RAM and 250 out of 500GB storage usage (whaaaat, I only had 3 text files).
This would be a nice thing to have. For now you can use a package like this:
have you tried using
os on glitch?
There’s a glitch-specific way of doing it, but it’ll take some searching