-
Notifications
You must be signed in to change notification settings - Fork 450
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
Add real and cores to CPU plugin on FreeBSD to match Linux #674
Conversation
dmesg contents are volatile. |
It should be fairly safe between majors |
Use dmesg to correctly determine the number of real CPUs, the number of real cores, and the number of HT cores. This aligns CPU count data with what we collect on Linux.
@arachnist i raised that question when we saw the same patch for dragonflybsd, but bsd users couldn't come up with a better API to query than dmesg... |
cpuinfo["total"] = $1.to_i | ||
when /FreeBSD\/SMP: (\d*) package\(s\) x (\d*) core\(s\)/ | ||
cpuinfo["real"] = $1.to_i | ||
cpuinfo["cores"] = $2.to_i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't this need to be $1.to_i * $2.to_i?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lamont-granquist do you mean the total should be real * cores? The line in dmesg above actually gives the number of cores including HT cores so we don't need to do the math.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I'm talking about the 'cores' computation. If this is a dual-socket quad-proc shouldn't that look like:
FreeBSD/SMP: Multiprocessor System Detected: 16 CPUs
FreeBSD/SMP: 2 package(s) x 4 core(s) x 2 SMT threads
and cpuinfo["cores"] should be 8 (2 x 4)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep. let me fix that one too
👍 |
LGTM |
Determine real, total, and cores for BSD
Use dmesg to correctly determine the number of real CPUs, the number of
real cores, and the number of HT cores. This aligns CPU count data with
what we collect on Linux.