Giampaolo Rodola' <g.rod...@gmail.com> added the comment: By re-reading https://bugs.python.org/issue30581 and https://github.com/giampaolo/psutil/issues/771#issuecomment-264457333 I now remember why I haven't fixed this issue in psutil yet: because the whole thing (MS APIs and doc basically) is confusing.
GetMaximumProcessorCount (now used by os.cpu_count()) returns "the maximum number of logical processors that a processor group or the system CAN have", not the actual number. That would explain why in OP's case os.cpu_count() returns 128 instead of 40. As per https://bugs.python.org/issue30581#msg295255 dwNumberOfProcessors wasn't good because it doesn't take multiple processor groups into account (hence the number may be too small) and GetLogicalProcessorInformationEx may be the way to go. This is based on the assumption that os.cpu_count() should report the number of CPUs in the system (including the non-usable ones, like in case of process groups). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33166> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com