-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Windows getloadavg improvements. Fixes #2664 #2665
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
base: master
Are you sure you want to change the base?
Conversation
|
And that, kids, is why you don't signal things with NANs and then not handle it... |
|
Just one newline missing. Might as well let it finish the checks... Or not. The new push is gonna go through checks too. |
|
Perhaps someone should make a clang-format config and add it to lint too, for the C files. I mean, my changes look reasonably close to what is already here, but perhaps a linter can do better... |
|
@giampaolo This is good to go, I think. Is there supposed to be a "request review" button somewhere? Ah whatever, @ works too. Hey what's this copilot button? They gave me some usage for free, might as well... This pull request significantly improves the accuracy and behavior of the Windows load average improvements:
Documentation updates:
Metadata and attribution: Changelog:
|
|
On second thought disk queue length is actually useful because Windows does have this tendency of freezing the entire explorer when you insert a broken drive. Alright it's just one more handle, how hard can it be. It would very likely be beneficial to mutex the whole initialization process, so that we don't do it twice by accident. (So: mutex the context.) That would unfortunately not remove the need for mutex on the tracking variables since the read-function actually resets error tracking, so it makes a write and has the potential to make things inconsistent! (Just reading would be fine, being stuck between two updates isn't that wrong.) Of course I could regress back to when there's no error tracking, but that's not cool. On second thought the last-error thing already steps over the last-last error, so what's more stepping on a foot? Plus the data size is so small we could use atomics if we really cared… |
|
There's no need for initialization mutex in C because (1) it's already held by a lock the Python part (2) it finishes one initialization in the main thread before handing it off to the timer. So it's always only gonna be one thread spawned. So why am I even doing HeapAlloc or bothering to protect any part of context? Mutex on the load and error variables is not strictly necessary for "okay" operation but might as well keep it. Bumping into it as held is going to be rare. |
|
Aha, there is clang-format now. Just gotta do some merging... |
|
Merges, builds, and runs ok, will rebase later |
* Add accounting for current-running processes via CPU load. The queue length would otherwise be not comparable to Unix systems. * Initialize at current load value instead of 0. * Use a new sampling interval of 4.615 seconds per Ripke. The disk queue length is still not implemented as it is not required to match most of Unix and would require another counter handle. Amend 1: Never return NaN or Infinity from util calculation. If things are about to go wrong, return a signaling negative value, set error variable, and skip this update tick. Amend 2: Make black happy, missed an empty line. Might as well fix up C formatting. Amend 3: User (or rather, webpage)-visible documentation. Amend 4: Instead of giving up update altogether, just regurgitate 1m util value. Would help 5m/15m continue to converge. Is also simpler. Optional disk queue for Windows loadavg. This helps admins who are more familiar with Linux-style as opposed to Unix-style calculation. Including the IO wait time complicates the "CPU overload" interpretation, but some admins prefer to use it as it does give a better idea of overall wait times. It's also common for the Windows explorer to just hang when you plug in a slow or failing disk, so there is definitely relevance. The disk queue is not included by default. Users must explicitly request it in the load-average sum using the ``selector`` parameter. In addition, add a way to fetch the last-tick load, similar to what one would obtain from running `ps -Max -o stat | grep ^[DR] | wc -l` on Linux.
|
I turned on IndentPPDirectives to remove one common reason for turning off c-f. |
|
What the heck is a dprint? Okay.. |
|
Hi,
Or to put it another way, let's not change the function signature to accept new args ( And once that is done I'll probably ask @ammaraskar if he can take a look, because this part of the code is obscure to me (and the new changes even more so). |
|
By default it returns the qu, so I think it is fine. I can split it into a different API if you want. |
|
More specifically, minimization will not be fruitful beyond a change of the API interface only.
|
Summary
getloadavg()improvements #2664Description
The disk queue length is still not implemented as it is not required to match most of Unix and would require another counter handle.