1

I tried cat /proc/cpuinfo but there is no "cpu cores" it works on LINUX though cat /proc/cpuinfo | grep "cpu cores"

Help me get a command for "cpu cores" in LINUX IA64

5
  • 1
    If it's not in cpuinfo then you're probably not getting it. Oct 28, 2011 at 5:02
  • hmm.. so how can i get cpu cores?
    – AabinGunz
    Oct 28, 2011 at 5:27
  • Which Linux-Kernel do you use? It works pretty well for me on SLES with kernel 2.6.16.60-0.69.1-smp
    – ddeimeke
    Oct 28, 2011 at 8:19
  • @ddeimeke: 2.6.18-128.el5 ia64
    – AabinGunz
    Oct 28, 2011 at 8:59
  • How about ls /sys/devices/system/cpu/ or ls /sys/class/cpuid/ or ls /proc/acpi/processor/ or anything else you can find with find /sys /proc -iname cpu*? Is the number of cores all that you want? Oct 28, 2011 at 12:26

4 Answers 4

3

lscpu displays this information. Part of the source code of lscpu is here.

Looks like what lscpu does is look in /sys/devices/system/cpu and counts the number of cpu? directories. So if you don't want to rely on an external command to determine number of cpu's you could always do that yourself in a script or application.

I got too lazy and quit reading before I figured out how to determine number of cores, sockets, cores per socket, threads per core and all that good stuff but if you read the code at that link you can figure all that out.

0

intel has some sample code on their website (the tarball is at the top of the page). Download, and compile it, and it should enumerate your cpus. I don't have any itanium systems, so I couldn't test it, but I've used this code when I had questions about systems.

1
  • 1
    Thanks for your answer, also I don't need any 3rd party utils, need something that's inbuilt
    – AabinGunz
    Oct 29, 2011 at 6:19
0

Do you have dmidecode installed? This issue just came up for me, and I needed nearly the same information you're asking for, and one of my coworkers suggested dmidecode.

# dmidecode -t processor | grep "Core Count"
Core Count: 4
Core Count: 4

That would indicate that there are 2 processors, with 4 cores each.

The full information available for a processor looks like:

Handle 0x0005, DMI type 4, 40 bytes
Processor Information
Socket Designation: LGA771/CPU2
Type: Central Processor
Family: Xeon
Manufacturer: Intel
ID: 7A 06 01 00 FF FB EB BF
Signature: Type 0, Family 6, Model 23, Stepping 10
Flags:
    FPU (Floating-point unit on-chip)
    VME (Virtual mode extension)
    DE (Debugging extension)
    PSE (Page size extension)
    TSC (Time stamp counter)
    MSR (Model specific registers)
    PAE (Physical address extension)
    MCE (Machine check exception)
    CX8 (CMPXCHG8 instruction supported)
    APIC (On-chip APIC hardware supported)
    SEP (Fast system call)
    MTRR (Memory type range registers)
    PGE (Page global enable)
    MCA (Machine check architecture)
    CMOV (Conditional move instruction supported)
    PAT (Page attribute table)
    PSE-36 (36-bit page size extension)
    CLFSH (CLFLUSH instruction supported)
    DS (Debug store)
    ACPI (ACPI supported)
    MMX (MMX technology supported)
    FXSR (Fast floating-point save and restore)
    SSE (Streaming SIMD extensions)
    SSE2 (Streaming SIMD extensions 2)
    SS (Self-snoop)
    HTT (Hyper-threading technology)
    TM (Thermal monitor supported)
    PBE (Pending break enabled)
Version: Intel(R) Xeon(R) CPU           E5405  @ 2.00GHz
Voltage: 1.4 V
External Clock: 1333 MHz
Max Speed: 5000 MHz
Current Speed: 2000 MHz
Status: Populated, Enabled
Upgrade: Slot 1
L1 Cache Handle: 0x0008
L2 Cache Handle: 0x0009
L3 Cache Handle: Not Provided
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Core Count: 4
Core Enabled: 4
Thread Count: 4
Characteristics: None

So there's a ton of information you can get out of dmidecode.

1
  • 1
    Thanks for your answer, also I don't need any 3rd party utils, need something that's inbuilt
    – AabinGunz
    Nov 11, 2011 at 4:26
0

If you have the POSIX-compliant /proc structure, you can do this:

$ num_cores=$(grep -c '^processor' /proc/cpuinfo)
1
  • 1
    Could you point me where in POSIX /proc/cpuinfo is specified? I've just looked in the SUSV4 and didn't find it. Dec 11, 2011 at 12:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .