Author giampaolo.rodola
Recipients giampaolo.rodola, paul.moore, pitrou, steve.dower, tim.golden, yanirh, zach.ware
Date 2018-03-28.14:53:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1522248792.99.0.467229070634.issue33166@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2018-03-28 14:53:13giampaolo.rodolasetrecipients: + giampaolo.rodola, paul.moore, pitrou, tim.golden, zach.ware, steve.dower, yanirh
2018-03-28 14:53:12giampaolo.rodolasetmessageid: <1522248792.99.0.467229070634.issue33166@psf.upfronthosting.co.za>
2018-03-28 14:53:12giampaolo.rodolalinkissue33166 messages
2018-03-28 14:53:12giampaolo.rodolacreate