Skip to content
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

psutil.cpu_count(logical=False) returns None on arm #1078

Closed
fake-name opened this issue May 17, 2017 · 5 comments
Closed

psutil.cpu_count(logical=False) returns None on arm #1078

fake-name opened this issue May 17, 2017 · 5 comments

Comments

@fake-name
Copy link

Basically, psutil.cpu_count() returns the correct number of cores (4, on a raspberry pi 3), but psutil.cpu_count(logical=False) returns nothing at all.

@giampaolo
Copy link
Owner

That is by design, meaning (also the doc states it) that if physical CPUs cannot be determined the function will return None, similarly to os.cpu_count() and multiprocessing.cpu_count().
With that said, please paste the output of cat /proc/cpuinfo. I assume on raspberry it's either empty or has a different format (in which case we may adjust the parsing logic and fix this issue).

@fake-name
Copy link
Author

Huh, I thought I didn't actually open this issue, because I wound up discovering that it intentionally returns None. As a result, I actually fixed it upstream in the package that uses cpuinfo (I'm doing stupid stuff with a pi, see gprMax/gprMax#111 ).

Anyways, sorry for the issue clutter, and I'll get you the contents of /proc/cpuinfo on monday, when I'm at work again.

@giampaolo
Copy link
Owner

It's OK. =)

@fake-name
Copy link
Author

Ok, the Pi's /proc/cpuinfo

130 pi@testpi:~$ cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 1
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 2
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 3
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

Hardware        : BCM2835
Revision        : a22042
Serial          : 00000000f4e64924


@giampaolo
Copy link
Owner

Yeah, the format is just different. It's better not to try to guess it and just return None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants