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

cpu.Counts(true) double-counts processors #1037

Closed
blalor opened this issue Feb 16, 2021 · 0 comments · Fixed by #1039
Closed

cpu.Counts(true) double-counts processors #1037

blalor opened this issue Feb 16, 2021 · 0 comments · Fixed by #1039

Comments

@blalor
Copy link

blalor commented Feb 16, 2021

Describe the bug

When cpu.Counts(true) parses /proc/cpuinfo, it counts every line that starts with processor (case-insensitive). In the case of /proc/cpuinfo showing the following for each cpu, the total number is double what it should be:

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

Expected behavior

Number of CPUs should match the actual number of CPUs.

Environment (please complete the following information):

Linux: Linux localhost 4.4.146+ #1 SMP PREEMPT Tue Feb 16 03:31:51 UTC 2021 armv7l

Additional context

This is an embedded device running Android. Full contents of /proc/cpuinfo is attached:
cpuinfo.txt.gz

Lomanic added a commit to Lomanic/gopsutil that referenced this issue Feb 21, 2021
Lomanic added a commit that referenced this issue Apr 13, 2021
[cpu][linux] Fix #1037 only count logical cores where 2nd field is a number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants