Hacker News new | past | comments | ask | show | jobs | submit login
lscpu + neofetch = cpufetch (github.com/dr-noob)
130 points by luke2m on April 8, 2021 | hide | past | favorite | 32 comments



Dr-Noob here. Created an account just to comment on this post. I appreciate all of your comments.

For the ones who think that cpufetch uses lscpu (especially the one who wrote the title of this post), please see https://www.reddit.com/r/linux/comments/milnza/cpufetch_simp...

About the peak performance, nezirus, the purpose is to have a quick look of how powerful a CPU is supposed to be. Peak performance does not measure the real performance of a CPU but it is a rough estimate of it. The peak performance is one of the distinguishing marks of cpufetch and is one of my favorite fields of cpufetch. Concerning the fight between Gold 6238 and EPYC 7702P, is not the other way around. If you are able to use the full power of the CPU, Gold is much more powerful. However, in a real program, this is not always true. For more information about the peak performance, see https://github.com/Dr-Noob/peakperf. There you will understand how peak performance is calculated and how it works.

Thank you very much for your "text screenshots", I really like to see my program on all this variety of hardware!


Sorry for the confusing title; unfortunately I can't change it anymore.


Raspberry Pi 4 Model B

$ ./cpufetch -s retro

                    ################                          
               #########################                      
            ###############################                   
          ################@@@@################                
         ################@@@@@@################               
        #################@@@@@@################               SoC:                 Broadcom BCM2711
       #################@@@@@@@@#################             Technology:          28nm
       #################@@@@@@@@#################             Microarchitecture:   Cortex-A72
      #################@@@@##@@@@################             Max Frequency:       1.500 GHz
       ################@@@@##@@@@################             Cores:               4 cores
       ###############@@@@####@@@@###############             Features:            NEON,CRC32
        @@@@@@@@@@####@@@@####@@@@####@@@@@@@@@@              Peak Performance:    24.00 GFLOP/s
         ######@@@@@@@@@@######@@@@@@@@@@######               
           ##################################                 
             ##############################                   
                ########################                      
                    ###############                           
                                                              



VM on M1 Mac

$ ./cpufetch -s legacy | sed 's,^, ,'

       ############     ##########   ####  ######  ########    SoC:                 Unknown
    ###############     #########    #######################   Technology:          Unknown
   ####        ####     ####         #####   #######   #####   Microarchitecture:   Cortex-A72
  ####         ####     ####         ####     #####     ####   Max Frequency:       Unknown
  ####         ####     ####         ####     ####      ####   Cores:               4 cores
   ####       #####     ####         ####     ####      ####   Features:            NEON,SHA1,SHA2,AES,CRC32
    ###############     ####         ####     ####      ####   Peak Performance:    Unknown
     ########  ####     ####         ####     ####      ####


WSL1:

$ ./cpufetch -s legacy

                               ################
                       #######                #######
                  ####                              ####
              ###                                     ####    Name:              Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz
         ###                                             ###  Hypervisor:        Microsoft Hyper-V
         ###                                             ###  Microarchitecture: Haswell
      #                    ###                ###        ###  Technology:        22nm
    ##   ###   #########   ######   ######    ###        ###  Max Frequency:     2.501 GHz
   ##    ###   ###    ###  ###    ####  ####  ###        ###  Cores:             8 cores (HT disabled)
  ##     ###   ###    ###  ###    ###    ###  ###       ###   AVX:               AVX,AVX2
 ##      ###   ###    ###  ###    ##########  ###     ####    FMA:               FMA3
 ##      ###   ###    ###  ###    ###         ###   #####     L1i Size:          32KB
 ##       ##   ###    ###   #####  #########   ##  ###        L1d Size:          32KB
 ###                                                          L2 Size:           256KB
  ###                                                         L3 Size:           6MB
  ####                                        ####            Peak Performance:  640.26 GFLOP/s
    #####                               ##########
      ##########               ################
          ###############################
For those interested, neofetch output on the same system:

$ neofetch --ascii

             .-/+oossssoo+/-.               tijdreiziger@machine
         `:+ssssssssssssssssss+:`           ------------
       -+ssssssssssssssssssyyssss+-         OS: Ubuntu 18.04.5 LTS on Windows 10 x86_64
     .ossssssssssssssssssdMMMNysssso.       Kernel: 4.4.0-18362-Microsoft
    /ssssssssssshdmmNNmmyNMMMMhssssss/      Uptime: 35 mins
   +ssssssssshmydMMMMMMMNddddyssssssss+     Shell: bash 4.4.20
  /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Terminal: /dev/tty2
 .ssssssssdMMMNhsssssssssshNMMMdssssssss.   CPU: Intel i7-4710MQ (8) @ 2.5GHz
 +sssshhhyNMMNyssssssssssssyNMMMysssssss+   Memory: 6750MiB / 8073MiB
 ossyNMMMNyMMhsssssssssssssshmmmhssssssso   Disk (/): 201G / 221G (93%)
 ossyNMMMNyMMhsssssssssssssshmmmhssssssso 
 +sssshhhyNMMNyssssssssssssyNMMMysssssss+
 .ssssssssdMMMNhsssssssssshNMMMdssssssss.
  /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/
   +sssssssssdmydMMMMMMMMddddyssssssss+
    /ssssssssssshdmNNNNmyNMMMMhssssss/
     .ossssssssssssssssssdMMMNysssso.
       -+sssssssssssssssssyyyssss+-
         `:+ssssssssssssssssss+:`
             .-/+oossssoo+/-.


I just realised after years of learning about how cores work that the big.LITTLE design is actually two CPUs not two sets of cores. With a third X1 core CPU we would then have 3 CPUs in a phone ... wow ...


It's processors all the way down.

There are probably tens to perhaps even hundreds of independent processors in a modern phone/computer system design. They're elements of essentially every chip in the device - especially if they provide complex/integrated functionality or communicate digitally with other chips.


If someone would say "processor", I'd expect them to mean the CPU, meaning the Central Processor Unit. The rest, I'd call them ICs.


Your typical harddrive has a full ARM core in it. Sure, it's an IC, but it's also reasonable to call it a processor (co-processor?).


Or three cores: http://spritesmods.com/?art=hddhack&page=3 (2013, I think). The author only considers one of them "microcontroller-ish", the other two are "quite powerful arm9-like".


So they are essentially a combination of chips rather than a combination of logical units. I always assumed these ‘chips’ are made of logical units like computer cpus 20 years ago with different logical units but that is not true. This is probably why the M1 is better than the microsoft’s ARM implementation because probably Apple is not going the processor route and instead more tightly integrating these logical units reducing latency. This is definitely more work but the it’s probably worth it when you control every bit of the pipeline which is not possible when the pipeline is made of several vendors with their SDKs like on snapdragon based windows laptop.


Thank you for "processors all the way down"


The Qualcomm Snapdragon 888 has three distinct types of cores.

"Snapdragon 888 ... has three CPU core sizes: a single large ARM X1 core for big single-threaded workloads, three medium Cortex A78 cores for multicore work, and four Cortex A55 cores for background work."

https://arstechnica.com/gadgets/2021/04/new-reports-say-the-...


What's the purpose for calculating "peak performance" (yes, I've seen the disclaimer in the source code that it is inaccurate)

Looking into example screenshots, Xeon Gold 6328 is 10TFLOP/s, while Epyc 7702p is 2 TFLOP/s Performance comparsion can only be the other way around :-)


I haven't done an lscpu check in a long time... at some point apparently it started telling me whether I am vulnerable to a whole bunch of cpu issues. That's amazing.


I'm on Oracle Linux.

Newer kernels report this in /proc/cpuinfo, and also /sys/devices/system/cpu/vulnerabilities.

When I run the UEK 5.4 kernel, I can see the following:

    $ grep 'model name' /proc/cpuinfo | uniq
    model name : Intel(R) Xeon(R) CPU E5-2609 0 @ 2.40GHz
    $ grep bugs /proc/cpuinfo | uniq
    bugs  : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
    $ dmesg | grep DMI:
    [    0.000000] DMI: HP ProLiant DL380p Gen8, BIOS P70 05/24/2019
When I run the RedHat-Compatible 3.10 Kernel, it doesn't report the bugs.

This is Oracle/RedHat 7.9 Maipo, and lscpu doesn't report the bugs under either kernel.


  lstopo (1) on linux machines is quite instructive. if you have not used it before.


Yes, in general, hwloc (from which lstopo comes) is the thing to use for anything to do with CPU/memory topology, e.g. pinning to logical cores rather than physical ones whose numbering can even change with BIOS updates.


Strangely on my system `lstopo` shows only 7 CPU cores (0-6), instead of 8.


I just built and run it to see the pretty logo in my terminal. It looks just as the pictures on github, and somehow it was still worth it. Good one dr-noob


I like it :)

I've never been much of a hardware guy, so I didn't know anything about my CPU. I have a shell alias called `i` (for info) that runs `neofetch && duf`, and I added cpufetch to that command


For those who don't know what duf is:

https://github.com/muesli/duf

it's a spiffier df .


Thanks, I didn't know about duf!


My favourite in that class of tools is `ncdu`. In a few seconds you can navigate through the files in your system and see (+delete) the space wasters!

https://en.wikipedia.org/wiki/Ncdu#/media/File:Ncdu_screensh...


My Thinkpad T410

luke@arch ~> cpufetch -s retro

                               ################               
                       #######                #######         
                  ####                              ####      
              ###                                     ####    Name:              Intel(R) Core(TM) i5 CPU M 520 @ 2.40GHz
         ###                                             ###  Microarchitecture: Westmere
         ###                                             ###  Technology:        32nm
      #                    ###                ###        ###  Max Frequency:     2.400 GHz
    ##   ###   #########   ######   ######    ###        ###  Cores:             2 cores (4 threads)
   ##    ###   ###    ###  ###    ####  ####  ###        ###  AVX:               No
  ##     ###   ###    ###  ###    ###    ###  ###       ###   FMA:               No
 ##      ###   ###    ###  ###    ##########  ###     ####    L1i Size:          32KB (64KB Total)
 ##      ###   ###    ###  ###    ###         ###   #####     L1d Size:          32KB (64KB Total)
 ##       ##   ###    ###   #####  #########   ##  ###        L2 Size:           256KB (512KB Total)
 ###                                                          L3 Size:           3MB
  ###                                                         Peak Performance:  19.20 GFLOP/s
  ####                                        ####            
    #####                               ##########            
      ##########               ################               
          ###############################


Bizarrely, this works fine in WSL (only missing max frequency), but doesn't work on Ubuntu Server running on bare metal. It identifies the CPU as Intel, but that's it.


WSL1 is essentially bare metal and can run the CPUID instruction directly. WSL2 would run the same instruction, but it would trap cpuid in HyperV; passing-through some information, and synthesize other pieces (or at least, that's what I've seen other hypervisors do).

Maybe the CPU in your Ubuntu machine is new and unrecognized by the program? I don't have any better guess.


For the most detailed info about x86 CPUs (only) I run cpuid.



Which tool was used to convert the logos to ASCII text?


There are a bunch of 2ascii utils, no idea what the author used but https://github.com/alexvking/png2ascii


This is sweet! Thanks for sharing.


My old desktop:

                                                              Name:              AMD Phenom(tm) II X2 550 Processor
                                                              Microarchitecture: K10
                                                              Technology:        45nm
     @@@@      @@@       @@@   @@@@@@@@        ############   Max Frequency:     3.100 GHz
    @@@@@@     @@@@@   @@@@@   @@@    @@@        ##########   Cores:             2 cores
   @@@  @@@    @@@@@@@@@@@@@   @@@      @@      #     #####   AVX:               No
  @@@    @@@   @@@  @@@  @@@   @@@      @@    ###     #####   FMA:               No
 @@@@@@@@@@@@  @@@       @@@   @@@    @@@    #########  ###   L1i Size:          64KB (128KB Total)
 @@@      @@@  @@@       @@@   @@@@@@@@@     ########    ##   L1d Size:          64KB (128KB Total)
                                                              L2 Size:           512KB (1MB Total)
                                                              L3 Size:           6MB
                                                              Peak Performance:  24.80 GFLOP/s
My recent laptop:

                                                              Name:              AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx 
                                                              Microarchitecture: Zen+
                                                              Technology:        12nm
     @@@@      @@@       @@@   @@@@@@@@        ############   Max Frequency:     2.100 GHz
    @@@@@@     @@@@@   @@@@@   @@@    @@@        ##########   Cores:             4 cores (8 threads)
   @@@  @@@    @@@@@@@@@@@@@   @@@      @@      #     #####   AVX:               AVX,AVX2
  @@@    @@@   @@@  @@@  @@@   @@@      @@    ###     #####   FMA:               FMA3
 @@@@@@@@@@@@  @@@       @@@   @@@    @@@    #########  ###   L1i Size:          64KB (256KB Total)
 @@@      @@@  @@@       @@@   @@@@@@@@@     ########    ##   L1d Size:          32KB (128KB Total)
                                                              L2 Size:           512KB (2MB Total)
                                                              L3 Size:           4MB
                                                              Peak Performance:  134.40 GFLOP/s
                                                              
Last year's server:

                                                              Name:              AMD EPYC 7351P 16-Core Processor 
                                                              Microarchitecture: Zen
                                                              Technology:        14nm
     @@@@      @@@       @@@   @@@@@@@@        ############   Max Frequency:     2.400 GHz
    @@@@@@     @@@@@   @@@@@   @@@    @@@        ##########   Cores:             16 cores (32 threads)
   @@@  @@@    @@@@@@@@@@@@@   @@@      @@      #     #####   AVX:               AVX,AVX2
  @@@    @@@   @@@  @@@  @@@   @@@      @@    ###     #####   FMA:               FMA3
 @@@@@@@@@@@@  @@@       @@@   @@@    @@@    #########  ###   L1i Size:          64KB (1MB Total)
 @@@      @@@  @@@       @@@   @@@@@@@@@     ########    ##   L1d Size:          32KB (512KB Total)
                                                              L2 Size:           512KB (8MB Total)
                                                              L3 Size:           8MB (64MB Total)
                                                              Peak Performance:  614.40 GFLOP/s




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: