Git Product home page Git Product logo

Comments (4)

shirou avatar shirou commented on August 27, 2024

Thank you for the report!
I confirmed about could not get CPUInfo on ARM v7, ubuntu 15.04 by using https://www.scaleway.com/.

I prefer more widely used way. I think your a) lscpu approach is major than b). I would appreciate you if you make some PR. Thank you.

from gopsutil.

ranjib avatar ranjib commented on August 27, 2024

@shirou awesome. i would love to contribute :-)
Question: lscpu output is fairly different than /proc/cpuinfo ,

  • it does not have things like flags, cpu family etc.
    • fields are inconsistent across arch. I'm posting examples of intel and arm lscpu data. e.g. CPU MHz has min & max fields on arm
    • lscpu data is aggregate output. i.e. unlike cpuinfo which has one entry per core, lscpu is summary of all cpu

I am thinking of several things, but not sure which one is best.

  • introduce a separate struct to expose lscpu info (consumer codes need to be updated)
  • interpret and build a array of CPUStats from lscpu data (not sure we'll get all logic right, or we;ll have all data.)
    comments?
    Intel lscpu output
  Architecture:          x86_64 
  CPU op-mode(s):        32-bit, 64-bit
  Byte Order:            Little Endian                                                                                                    
  CPU(s):                4                                                                                                                
  On-line CPU(s) list:   0-3                                                                                                              
  Thread(s) per core:    2                                                                                                                
  Core(s) per socket:    2                                                                                                                
  Socket(s):             1                                                                                                                
  NUMA node(s):          1
  Vendor ID:             GenuineIntel
  CPU family:            6
  Model:                 58
  Stepping:              9
  CPU MHz:               2932.519
  BogoMIPS:              4988.38
  Virtualization:        VT-x
  L1d cache:             32K                                                                                                              
  L1i cache:             32K                                                                                                              
  L2 cache:              256K                                                                                                             
  L3 cache:              4096K                                                                                                            
  NUMA node0 CPU(s):     0-3     

arm lscpu output



  Architecture:          armv7l                                                                                                           
  Byte Order:            Little Endian                                                                                                    
  CPU(s):                4                                                                                                                
  On-line CPU(s) list:   0-3                                                                                                              
  Thread(s) per core:    1                                                                                                                
  Core(s) per socket:    4                                                                                                                
  Socket(s):             1                                                                                                                
  Model name:            ARMv7 Processor rev 5 (v7l)                                                                                      
  CPU max MHz:           900.0000                                                                                                         
  CPU min MHz:           600.0000                   

from gopsutil.

shirou avatar shirou commented on August 27, 2024

@ranjib Thank you for the information. On my understanding, only ARM can not get information from /proc/cpuinfo. So I think how about separating into two files cpu_linux.go and cpu_linux_arm.go such as

  • for amd, get from /proc/cpuinfo
  • for ARM, get from lscpu

Will that work?

from gopsutil.

cbednarski avatar cbednarski commented on August 27, 2024

@shirou That sounds good to me! I am not familiar with arm on linux outside of Rasbpian but that's my primary use case for this feature. Let me know if you need help with this.

from gopsutil.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.