-
-
Notifications
You must be signed in to change notification settings - Fork 635
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
[BUG] Apple M CPU Generation not displayed #678
Comments
Could you add a
at the top of the file and a
below Edit: #include <iostream>
#include <string>
#include <sys/sysctl.h>
int main() {
char buffer[1024];
std::size_t size = sizeof buffer;
sysctlbyname("machdep.cpu.brand_string", &buffer, &size, nullptr, 0);
std::cout << std::string { buffer } << '\n';
} |
i don't know c++ but i had to make a minor change to get it to compile #include <iostream>
#include <string>
#include <sys/sysctl.h>
int main() {
char buffer[1024];
std::size_t size = sizeof buffer;
sysctlbyname("machdep.cpu.brand_string", &buffer, &size, nullptr, 0);
std::cout << std::string(buffer) << '\n';
}
|
ok i just launched btop to have another look and its actually an issue with the text length and different scaling, so i assume here Line 2066 in 0d35746
it should rather be cutting off "Apple" in Line 203 in 0d35746
but this would still be to long on a M2 Ultra as that's 8 characters and it currently seems to be cut to 7 |
@masiboss To fix this the following line need to be edited: Line 2066 in 0d35746
And needs to check if cpu frequency is available, if not, the |
There is also a config variable that should be checked I think the size would be |
Something like: const string cpu_title = uresize(
(custom.empty() ? Cpu::cpuName : custom),
b_width - (Config::getB("show_cpu_freq") and not Cpu::get_cpuHz().empty() ? 14 : 4)
); This would need to be tested on all platforms though since the |
Maybe a better way to go about it would be to have it like: static const bool hasCpuHz = not Cpu::get_cpuHz().empty()
const string cpu_title = uresize(
(custom.empty() ? Cpu::cpuName : custom),
b_width - (Config::getB("show_cpu_freq") and hasCpuHz ? 14 : 4)
); |
went ahead and added that to my pull request, i still think stripping out "Apple" is correct for consistency with the other CPU brands |
Describe the bug
The CPU name is displayed as Apple M, while on a Apple M2
i belive it is read here
btop/src/osx/btop_collect.cpp
Lines 207 to 212 in 0f8498f
however
sysctl -a | grep machdep.cpu.brand_string
returns
machdep.cpu.brand_string: Apple M2
To Reproduce
Install on a Apple Silicon Mac
Expected behavior
Displays Apple M2
Screenshots
Info (please complete the following information):
The text was updated successfully, but these errors were encountered: