Neofetch: CPU display format wrong for CPUs < 1 Ghz

Created on 4 Apr 2016  路  23Comments  路  Source: dylanaraps/neofetch

Tested with version 1.5 and 1.6 the CPU line ist formatted wrong on my Raspberry Pi:

 OS: Raspbian GNU/Linux 8.0 (jessie) x86
 Kernel: 4.1.19+
 Uptime: up 1 hour, 30 minutes
 Packages: 1295
 Shell: /usr/bin/zsh
 CPU: ARMv6-compatible processor rev 7 (v6l) @ 7.GHz
 Memory: 130MB / 371MB

Suggested solution: Output Ghz with leading zero if CPU < 1 Ghz

Bug

All 23 comments

Thanks for reporting this, I'm working on a fix as we speak.

What does this output on your system?

 read -r speed < /sys/devices/system/cpu/cpu0/cpufreq/current

I'm trying to find out the format of the speed when it's below 1ghz.

/sys/devices/system/cpu/cpu0/cpufreq/current does not exist on my system (raspberry pi, raspbian "jessie")
sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq contains the value 700000 (raspberry pi B, 700 Mhz)
on a second system (raspberry pi, arch linux)
sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq contains the value 900000 (raspberry pi 2B, 900 Mhz)

If it doesn't exist then the script falls back to /proc/cpuinfo. What does this output?

awk -F ': ' '/siblings/ {printf $2; exit}' /proc/cpuinfo

Both systems return nothing for this command.

Raspberry Pi 1 (Single Core):

cat /proc/cpuinfo returns:

processor       : 0
model name      : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 2.00
Features        : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2708
Revision        : 000e
Serial          : XXXXXXXXXXXXXX

Raspberry Pi 2 (Multicore)

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

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

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

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

Hardware        : BCM2709
Revision        : a01041
Serial          : XXXXXXXXXXXXXX

(Serial removed)

Thanks, I can work with this. :)

1 Test works, 1 Fails:

Raspberry Pi 1:

  .',;:cc;,'.    .,;::c:,,.   USERNAME@COMPUTERNAME
 ,ooolcloooo:  'oooooccloo:   ---------
 .looooc;;:ol  :oc;;:ooooo'   OS: Raspbian GNU/Linux 8.0 (jessie) x86
   ;oooooo:      ,ooooooc.    Kernel: 4.1.19+
     .,:;'.       .;:;'.      Uptime: up 3 hours, 15 minutes
     .... ..'''''. ....       Packages: 1295
   .''.   ..'''''.  ..''.     Shell: /usr/bin/zsh
   ..  .....    .....  ..     CPU: ARMv6-compatible processor rev 7 (v6l) @ 7.GHz
  .  .'''''''  .''''''.  .    Memory: 141MB / 371MB
.'' .''''''''  .'''''''. ''.
'''  '''''''    .''''''  '''
.'    ........... ...    .'.
  ....    ''''''''.   .''.
  '''''.  ''''''''. .'''''
   '''''.  .'''''. .'''''.
    ..''.     .    .''..
          .'''''''
           ......

Raspberry Pi 2:

-` ----------- .o+` OS: Arch Linux ARM x86 `ooo/ Kernel: 4.1.18-3-ARCH `+oooo: Uptime: up 4 weeks, 4 days, 14 hours, 40 minutes `+oooooo: Packages: 568 -+oooooo+: Shell: /usr/bin/zsh `/:-:++oooo+: CPU: ARMv7 rev 5 (v7l) @ 0.9GHz `/++++/+++++++: Memory: 243MB / 923MB `/++++++++++++++: `/+++ooooooooooooo/` ./ooosssso++osssssso+` .oossssso-````/ossssss+` -osssssso. :ssssssso. :osssssss/ osssso+++. /ossssssss/ +ssssooo/- `/ossssso+/:- -:/+osssso+- `+sso+:-` `.-/+oso: `++:. `-/+/ .` `/

By the way: Where does the "x86" in the OS come from?

Weird, does the /sys/devices/system/cpu/cpu0/cpufreq directory exist?

By the way: Where does the "x86" in the OS come from?

I'm getting it from: getconf LONG_BIT

What does getconf LONG_BIT output on your system?

Yes, the /sys/devices/system/cpu/cpu0/cpufreq directory exist (on both systems)

ls /sys/devices/system/cpu/cpu0/cpufreq

affected_cpus     cpuinfo_max_freq  cpuinfo_transition_latency  scaling_available_frequencies  scaling_cur_freq  scaling_governor  scaling_min_freq
cpuinfo_cur_freq  cpuinfo_min_freq  related_cpus                scaling_available_governors    scaling_driver    scaling_max_freq  scaling_setspeed

32, which is correct; But these are ARM Processors, not Intel compatible;

I can't see why it wouldn't be working for you, if I spoof the speed to the numbers you provided above it all works as it should.

32, which is correct; But these are ARM Processors, not Intel compatible;

For now I'm going to make the architecture stuff off by default until I find a better way to get the value.

Sorry, my mistake: I overlooked the git version of Testhardware 1:

  .',;:cc;,'.    .,;::c:,,.   USERNAME@COMPUTERNAME
 ,ooolcloooo:  'oooooccloo:   ---------
 .looooc;;:ol  :oc;;:ooooo'   OS: Raspbian GNU/Linux 8.0 (jessie) x86
   ;oooooo:      ,ooooooc.    Kernel: 4.1.19+
     .,:;'.       .;:;'.      Uptime: up 3 hours, 35 minutes
     .... ..'''''. ....       Packages: 1295
   .''.   ..'''''.  ..''.     Shell: /usr/bin/zsh
   ..  .....    .....  ..     CPU: ARMv6-compatible processor rev 7 (v6l) @ 0.7GHz
  .  .'''''''  .''''''.  .    Memory: 144MB / 371MB
.'' .''''''''  .'''''''. ''.
'''  '''''''    .''''''  '''
.'    ........... ...    .'.
  ....    ''''''''.   .''.
  '''''.  ''''''''. .'''''
   '''''.  .'''''. .'''''.
    ..''.     .    .''..
          .'''''''
           ......

Thank you very much for your dedicated engagement :)

Architecture should also be fixed.

I pushed it to the same branch so do another pull and let me know if it's working. :)

Suggestion: Architecture could simply be "solved" by replacing "x86 / x64" with "32 Bit / 64 Bit"; This would also work on other plattforms (like in my example ARM), where different processors exist.

Alright, that seems like a better solution. :)

Edit: Done.

Although I would assume the "OS" states the installed processor-plattform support (for example, raspbian is compiled for amv6l, though it also works on armv7; You can run a 32 bit Linux on a 64 bit processor;)

So I would expect something like this:

OS: DISTRIBUTION_NAME 1.23 (cool_code_name) 32 Bit
CPU: 64 Bit Intel compatible .... @ 4.2GHz

This would help to distinguish different OS Installations;

Though yours seems to work, aside from an error message (commit e75a67f);

  .',;:cc;,'.    .,;::c:,,.   USERNAME@COMPUTERNAME
 ,ooolcloooo:  'oooooccloo:   ---------
 .looooc;;:ol  :oc;;:ooooo'   OS: Raspbian GNU/Linux 8.0 (jessie) armv6l
   ;oooooo:      ,ooooooc.    Kernel: 4.1.19+
     .,:;'.       .;:;'.      Uptime: up 3 hours, 41 minutes
     .... ..'''''. ....       Packages: 1295
   .''.   ..'''''.  ..''.     Shell: /usr/bin/zsh
   ..  .....    .....  ..     CPU: ARMv6-compatible processor rev 7 (v6l) @ 0.7GHz
  .  .'''''''  .''''''.  .    Memory: 137MB / 371MB
.'' .''''''''  .'''''''. ''.
'''  '''''''    .''''''  '''
.'    ........... ...    .'.
  ....    ''''''''.   .''.
  '''''.  ''''''''. .'''''
   '''''.  .'''''. .'''''.
    ..''.     .    .''..
          .'''''''
           ......

and

./neofetch: line 773: xprop: command notUSERNAME@HOSTNAME -` ----------- .o+` OS: Arch Linux ARM armv7l `ooo/ Kernel: 4.1.18-3-ARCH `+oooo: Uptime: up 4 weeks, 4 days, 15 hours, 12 minutes `+oooooo: Packages: 568 -+oooooo+: Shell: /usr/bin/zsh `/:-:++oooo+: CPU: ARMv7 rev 5 (v7l) @ 0.9GHz `/++++/+++++++: Memory: 250MB / 923MB `/++++++++++++++: `/+++ooooooooooooo/` ./ooosssso++osssssso+` .oossssso-````/ossssss+` -osssssso. :ssssssso. :osssssss/ osssso+++. /ossssssss/ +ssssooo/- `/ossssso+/:- -:/+osssso+- `+sso+:-` `.-/+oso: `++:. `-/+/ .` `/

I think your new solution looks very good (apart from the xprop problem remaining on arch linux)
Raspi 1:

OS: Raspbian GNU/Linux 8.0 (jessie) 32-bit

Raspi 2:

OS: Arch Linux ARM 32-bit

Right now I do not have a 64 Bit Arm system available to test the difference there;

So I would expect something like this:

OS: DISTRIBUTION_NAME 1.23 (cool_code_name) 32 Bit
CPU: 64 Bit Intel compatible .... @ 4.2GHz

This would help to distinguish different OS Installations;

I can't think of a simple way to do this, any ideas?

apart from the xprop problem remaining on arch linux

Fixed. (Try the same branch again.)

I think it'll be better if we use uname -m instead of hardcoding 32/64-bit, the uname command prints the arch the kernel was compiled for and has a nicer output imo.

See this wiki page and have a look at the uname -m column.

https://en.wikipedia.org/wiki/Uname

Very nice!

Output from Raspberry Pi 2:

-` USERNAME@COMPUTER .o+` ----------- `ooo/ OS: Arch Linux ARM 32-bit `+oooo: Kernel: 4.1.18-3-ARCH `+oooooo: Uptime: up 4 weeks, 4 days, 16 hours, 17 minutes -+oooooo+: Packages: 568 `/:-:++oooo+: Shell: /usr/bin/zsh `/++++/+++++++: CPU: ARMv7 rev 5 (v7l) @ 0.9GHz `/++++++++++++++: Memory: 246MB / 923MB `/+++ooooooooooooo/` ./ooosssso++osssssso+` .oossssso-````/ossssss+` -osssssso. :ssssssso. :osssssss/ osssso+++. /ossssssss/ +ssssooo/- `/ossssso+/:- -:/+osssso+- `+sso+:-` `.-/+oso: `++:. `-/+/ .` `/```

Good to see that it's working now!

What are your thoughts on my comment above?

https://github.com/dylanaraps/neofetch/issues/215#issuecomment-205280264

I think your idea is a very good one, also seems future-proof

Merged, thanks for the help!

Thank you for the projekt :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pelomedusa picture pelomedusa  路  4Comments

ghost picture ghost  路  5Comments

e-caste picture e-caste  路  7Comments

tadly picture tadly  路  9Comments

SolitudeSF picture SolitudeSF  路  4Comments