[BUG] Pentium CPU models just show as digit
See original GitHub issueI have an old Pentium 4 laptop. The CPU shows up in BpyTOP currently as just “4”.
cat /proc/cpuinfo
Result: model name : Intel(R) Pentium(R) 4 CPU 2.80GHz
Secondary issue is if the CPU temp is not available, the CPU info box is too small to display more than seven characters for the CPU name. So if I force it to display “BlahBlahBlah” as the model name, BpyTOP will only show “BlahBla”. Which leaves off the actual model number such as “III”, “3” or “4”.
So my suggested patch for this uses a shortened version of “Pentium” to deal with the possibility of having no CPU temps being displayed. To show the full “Pentium 4” name would need some logic to check that the length of the CPU info box is sufficient to display all characters extracted from the model name.
The patch is very simple. Add this just below the test for “Xeon”:
elif "Pentium" in name:
name = "Pent-" + nlist[nlist.index("CPU")-1]
After patch:
if "Xeon" in name and "CPU" in name:
name = nlist[nlist.index("CPU")+1]
elif "Pentium" in name:
name = "Pent-" + nlist[nlist.index("CPU")-1]
elif "Ryzen" in name:
name = " ".join(nlist[nlist.index("Ryzen"):nlist.index("Ryzen")+3])
elif "Duo" in name and "@" in name:
name = " ".join(nlist[:nlist.index("@")])
elif "CPU" in name and not nlist[0] == "CPU":
name = nlist[nlist.index("CPU")-1]
name = " ".join(name.split())
return name.replace("Processor ", "").replace("CPU ", "").replace("(R)", "").replace("(TM)", "").replace("Intel ", "")
This produces “Pent-4” for the model name on my machine. More than adequate, unless you really want to spend the extra 15 minutes to figure out how to calculate the length of the CPU info box and display “Pentium 4” if there is enough room and compact it to “Pent-4” if there isn’t.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
Added in v1.0.34
@RedBearAK This is the regex I added
\d?\.?\d+GHz
will change it so the full replace block after the search will be: