Giter Club home page Giter Club logo

lscpu's Introduction

lscpu

lscpu for BSDs. The main usage of this program should be for x86 architecture since it leverages CPUID instructions. For other architectures, it just shows very limited facts.

lscpu has been verified to work on following BSDs:

macOSOpenBSDFreeBSDNetBSD
DragonFlyBSDMidnightBSDTrueOS?

It should also work on other BSDs, though not tested. If you find lscpu also runs on other BSDs, please tell me by mail or just open a new issue, thanks very much in advance!

Usage

$ git clone https://github.com/NanXiao/lscpu.git
$ cd lscpu
$ make
$ ./lscpu

Output

$ ./lscpu
Architecture:            i386
Byte Order:              Little Endian
Active CPU(s):           2
Total CPU(s):            2
Thread(s) per core:      1
Core(s) per socket:      2
Socket(s):               1
Vendor:                  GenuineIntel
CPU family:              6
Model:                   63
Model name:              Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz ("GenuineIntel" 686-class)
Stepping:                2
CPU MHz:                 2401
L1d cache:               32K
L1i cache:               32K
L2 cache:                256K
L3 cache:                15M
Flags:                   fpu vme de pse tsc msr mce cx8 apic sep mtrr pge mca cmov pat pse36 cflsh mmx fxsr sse sse2 htt sse3 pclmulqdq ssse3 cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx rdrnd fpcsds syscall pdpe1gb lahf_lm

Acknowledgement

Thanks to yggdr for testing on AMD processors.
Thanks to bit_of_hope for testing on NetBSD.
Thanks to Aleksej Lebedev for testing on DragonFlyBSD.
Thanks to Lucas Holt for testing on MidnightBSD and adding lscpu to the MidnightBSD mports tree.
Thanks to zi0r for adding lscpu to the FreeBSD ports tree.
Thanks to Brian Callahan for adding lscpu to the OpenBSD ports tree.

lscpu's People

Contributors

ibara avatar nanxiao avatar pkubaj avatar raimue avatar yggdr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

lscpu's Issues

AMD threads per core incorrectly hardcoded to 1

Looking at https://www.amd.com/en/products/specifications/processors two threads per core is typical, but lscpu forcesthreads_per_core to 1 for AMD CPUs

https://github.com/NanXiao/lscpu/blob/master/lscpu.c#L805

    if (is_amd_cpu(x86_info->vendor))
    {
        /* AMD doesn't support Hyper-Threading */
        x86_info->threads_per_core = 1;
        x86_info->cores_per_socket = 1;

With Linux installed on a piece of test hardware, Linux lscpu reports
Thread(s) per core: 2
Core(s) per socket: 64
Socket(s): 2

On the same hardware with FreeBSD installed this lscpu reports
Thread(s) per core: 1
Core(s) per socket: 128
Socket(s): 2

Please create a release

It doesn't matter if it is version 1.0 or version 0.0.1. Please tag a release so port maintainers can easily add a port for your code.

"Cannot allocate memory" on OpenBSD/i386 5.8

Output on OpenBSD/i386 5.8 on an PC Engines ALIX (AMD Geode processor):
lscpu: HW_MODEL: Cannot allocate memory

cc is gcc version 4.2.1 20070719

While being an older OpenBSD version, this error surprised me. On an 6.1/amd64 VM it worked as expected.

MidnightBSD compatibility

lscpu is working with MidnightBSD provided it is compiled with GCC. The system version of clang/llvm does not support __cpuid. This support was just added in current. Also added to mports.

Here is sample output


Architecture:            amd64
Byte Order:              Little Endian
Total CPU(s):            16
Thread(s) per core:      2
Core(s) per socket:      8
Socket(s):               1
Vendor:                  GenuineIntel
CPU family:              6
Model:                   45
Model name:              Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz
Stepping:                7
L1d cache:               32K
L1i cache:               32K
L2 cache:                256K
L3 cache:                20M
Flags:                   fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 cflsh ds acpi mmx fxsr sse sse2 ss htt tm pbe sse3 pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline aes xsave osxsave avx syscall nx pdpe1gb rdtscp lm lahf_lm

brew install lscpu

Request / Suggestion: brew "formula" to enable OS X users to invoke:

`brew install lscpu

JSON output

It would be nice if there is an option to output information as a JSON, for example lscpu -j

NetBSD Big Endian ARM64 kind of works

arm64# ./lscpu
Architecture:    evbarm
Byte Order:      Big Endian
Total CPU(s):    4
Model name:   raspberrypi,3-model-b-plus
arm64#

Nothing else was printed, which is why I say it kind of works.

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.