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
windows implementation based on typeperf tool #7
Conversation
My build is working on windows by using wmic. You might want to test it but this refactor is too messy and does not pass tests. |
wmic is the way to go in my opinion, it might be not enough tested but if you really want, you may improve it. |
Regarding failing tests, actually the test itself is not correct. The \Process(*)\Working Set - Private as I also mentioned readme is not available in older versions of windows,I by mistake included it in test so it will fail under WinXP. I can fix the test if you like the approach. |
I left some comments on the code. Have you tested the I'll test the code as soon as I get my hand on a windows computer ;). |
with Also I just checked under WinXP virtual machine and it didn't work. Looks like |
Interesting, so wmic is definitely less accurate, I'll take the time to test this! |
Please fork the windows branch if you want to have the same code as I have ;) |
I think I've found why it's not doing anything on my computer (and maybe appveyor). My computer is set in French and I get this output from It looks like |
That's tough :) It looks like there is some way to refer counters with IDs instead of names:
can be also written with IDs like
There is some information here but still I can't get correct syntax of getting the :( feel desperate, will try to figure this out this evening. |
Nice documentation thanks! Yeah if we can't rely on strings because of the language variation it sucks :/. I'll do some research on my own and let you know! |
My |
I tried under win xp and it didn't work even though the registry path is there and values are identical. I have idea to put some script on npm postinstall handler and check windows locale. if it's English (or at least commands are working) then keep using typeperf otherwise print some warning and/or provide information based on some less accurate tools. What do you think of that? |
+1 indeed that's just crap! Yeah but a |
Yes, i guess the wmic is last hope. Yesterday i didn't get how you |
https://github.com/soyuka/pidusage/blob/master/lib/stats.js#L125 It's well commented with references ;) Basically:
See the third reply there and then pcpu:
See wmic doc |
That comment refers to this link as for detailed explanation which is broken, so I can't be sure how accurate it is. One more important thing in that cpu usage formula i guess MUST use the number of processors. Maybe we can have small discussion with skype to understand what we can do. There are more questions for me than answers. My account is - zu_kalt. |
Interesting. How would the formula be altered by the number of processors? Come here to discuss: https://gitter.im/soyuka/pidusage?utm_source=share-link&utm_medium=link&utm_campaign=share-link |
Please review my changes.
It should do the same as as ps -o pcpu,rssize -p PID does.
The key rss (or rssize) looks same as "\Process(\Working Set" counter - amount of allocated memory by the process which will not result page fault when will be accessed. Similar thing is described in ps man page for rss.
The '% Processor Time' looks like similar to pcpu (not sure though). At least it shows the percentage of cpu usage by process between 2 measurements, the interval is in milliseconds.
Gurgen