-
Notifications
You must be signed in to change notification settings - Fork 151
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
Use library current-processes to generate the list of processes #35
Comments
Thanks very much :) |
It's getting there :) I just need to get at memory as a percentage to keep current behaviour if that's possible. |
Are the native |
My advise would be to check your |
Looks ok to me. It's all 35 chrome helper processes added up (one for each tab). This matches up with activity monitor and ps. vtop adds processes that are alike together. On Thu, Jun 19, 2014 at 9:10 PM, Bran van der Meer
|
Hm.. let me check. The linux adapter uses |
The description of the
|
How did you calculate memory in the old vtop? |
ps -ewwwo %cpu,%mem,comm Just used the %mem value from that |
Hmm.. http://virtualthreads.blogspot.nl/2006/02/understanding-memory-usage-on-linux.html |
MemoryOk, so this is a little more complex than I expected. Basically, there's 2 numbers that are interesting when it comes to memory usage of a process, virtual memory and private memory. Virtual MemoryVirtual memory is the amount of memory a process uses including all shared libraries. Those libraries are shared with other processes, but are only using memory once. If you've got 2 processes both using only 5mb of private memory, and they're using the same shared library which uses 10mb, then the virtual memory for both processes would be 15mb, a total of 30mb. But the actual total memory used is 20mb, since the shared library is only loaded to memory once. If you're doing calculations with virtual memory, total memory usage could exceed 100%, which is weird. Private MemoryThis is the amount of memory the process executable's source code plus the variables in it's private memory space actually takes. Shared libraries can't access memory inside the process that's using the shared library, hence it's called private. And now the bad news: CPUAnd the same goes for cpu usage, the percentage is actually a guesstimate: the OS just gives us the cputime, which is the amount of seconds a process has used the cpu, since the start of the process. So if a process is running a total of 10 seconds, and it used the cpu for 1 second total in that time, it's using 10% of cpu, when 10 seconds are measured. But if we're measuring a 5 second period, we would say it's using 20% of cpu. So I think I'm going to make the underlying numbers available as well. ConclusionTo account for all these situations, and give the user as much flexibility as possible, I should expose all these variables. Like this: {
pid: 4432,
name: 'chrome',
mem: {
virtual: 78923,
private: 56572,
percentage: private / os.totalmem() * 100
},
cpu: {
runtime: 65,
cputime: 10,
usage: cputime / runtime * 100
}
} |
Shared memory really does complicate this. OSX has a concept of 'memory pressure' which is something I've been looking into. |
This looks really good, makes the current-processes lib very useful |
Ok, so virtual and private memory are available, you can track progress here: branneman/current-processes#4 - You could use the repo directly already if you want to test with it. The cpu times are not yet available, will |
It's ready! Turns out calculating the cpu usage manually is undoable cross-platform, so it's using the one provided by The new version is v0.2.0 |
@MrRio - When do you think you can continue implementing the current-processes library? Or do you need/want some help with it? |
A hand on the feature-current-process branch would be amazing |
Check my https://www.npmjs.org/package/pidusage code to get pcpu and memory. I've made it work on darwin, freebsd, solaris (with In the case of About the pcpu, you'll need to keep an history if you want accuracy. |
Memory is still off by about a factor of 2 on Ubuntu http://i.imgur.com/XcPqRJb.png |
https://www.npmjs.org/package/current-processes
If there's anything you need help with, let me know.
The text was updated successfully, but these errors were encountered: