The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Operating Systems
> Linux Help
|
How-to determine the number of physical CPUs
Discuss How-to determine the number of physical CPUs in the Linux Help forum on Dev Shed. How-to determine the number of physical CPUs Linux Help forum discussing topics including usage, troubleshooting, modules, and distributions. Linux is an open source OS, based on UNIX.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

June 8th, 2012, 08:46 AM
|
|
Contributing User
|
|
Join Date: Jul 2006
Posts: 144
Time spent in forums: 1 Day 3 h 44 m 50 sec
Reputation Power: 7
|
|
|
How-to determine the number of physical CPUs
Hi
Few days ago i had problems with one of my sites, which use too much CPU.
Typing "TOP" i got that mysqld use 200-400 %CPU.
As i cann't find the real reason, i move it to another host - where it work well without any problem.
Now, when on previous host everying is well i check that mysql %CPU is fine, but TIME+ digits usually are very high - like in this example.
Can anybody explain what this mean "137:31.72"
PHP Code:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
8927 apache 20 0 36228 14m 5016 S 4.7 0.7 0:11.32 httpd
1771 mysql 20 0 53172 31m 4340 S 0.7 1.5 137:31.72 mysqld
Also, as i understand on previous host there are 4 processores, and 2 cores
grep "core id" /proc/cpuinfo
PHP Code:
[root@www ~]# grep "core id" /proc/cpuinfo
core id : 0
core id : 0
core id : 1
core id : 1
but cann't understand how many cores are on new host (with 8 processors)
PHP Code:
[root@host ~]# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU L5420 @ 2.50GHz
stepping : 10
cpu MHz : 2499.994
cache size : 6144 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu tsc msr pae cx8 apic cmov pat clflush acpi mmx fxsr sse sse2 ss ht nx constant_tsc pni vmx est ssse3 sse4_1
bogomips : 6258.29
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU L5420 @ 2.50GHz
stepping : 10
cpu MHz : 2499.994
cache size : 6144 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu tsc msr pae cx8 apic cmov pat clflush acpi mmx fxsr sse sse2 ss ht nx constant_tsc up pni vmx est ssse3 sse4_1
bogomips : 6258.29
processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU L5420 @ 2.50GHz
stepping : 10
cpu MHz : 2499.994
cache size : 6144 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu tsc msr pae cx8 apic cmov pat clflush acpi mmx fxsr sse sse2 ss ht nx constant_tsc up pni vmx est ssse3 sse4_1
bogomips : 6258.29
processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU L5420 @ 2.50GHz
stepping : 10
cpu MHz : 2499.994
cache size : 6144 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu tsc msr pae cx8 apic cmov pat clflush acpi mmx fxsr sse sse2 ss ht nx constant_tsc up pni vmx est ssse3 sse4_1
bogomips : 6258.29
processor : 4
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU L5420 @ 2.50GHz
stepping : 10
cpu MHz : 2499.994
cache size : 6144 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu tsc msr pae cx8 apic cmov pat clflush acpi mmx fxsr sse sse2 ss ht nx constant_tsc up pni vmx est ssse3 sse4_1
bogomips : 6258.29
processor : 5
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU L5420 @ 2.50GHz
stepping : 10
cpu MHz : 2499.994
cache size : 6144 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu tsc msr pae cx8 apic cmov pat clflush acpi mmx fxsr sse sse2 ss ht nx constant_tsc up pni vmx est ssse3 sse4_1
bogomips : 6258.29
processor : 6
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU L5420 @ 2.50GHz
stepping : 10
cpu MHz : 2499.994
cache size : 6144 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu tsc msr pae cx8 apic cmov pat clflush acpi mmx fxsr sse sse2 ss ht nx constant_tsc up pni vmx est ssse3 sse4_1
bogomips : 6258.29
processor : 7
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU L5420 @ 2.50GHz
stepping : 10
cpu MHz : 2499.994
cache size : 6144 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu tsc msr pae cx8 apic cmov pat clflush acpi mmx fxsr sse sse2 ss ht nx constant_tsc up pni vmx est ssse3 sse4_1
bogomips : 6258.29
As this command don't work on that host
PHP Code:
[root@host ~]# grep "core id" /proc/cpuinfo
[root@host ~]#
thank you
|

June 8th, 2012, 03:38 PM
|
 |
Lost in code
|
|
|
|
Quote: | Also, as i understand on previous host there are 4 processores, and 2 cores |
It's not physically possible to have fewer cores than processors. It's hard to tell from just seeing the "core id" lines, but my guess is that your old host was a single processor system with 2 physical cores with hyper-threading.
The L5420 is a 4 core processor without hyper-threading, so it looks like your new host is a dual processor system with a total of 8 physical cores.
Quote: | Can anybody explain what this mean "137:31.72" |
It means the process has spent 137 minutes and 31.72 seconds of the processor's time. If the processor has 2 cores, then for every 1 minute of real time the processor has 2 minutes of processor time available.
|

June 8th, 2012, 04:56 PM
|
|
Contributing User
|
|
Join Date: Jul 2006
Posts: 144
Time spent in forums: 1 Day 3 h 44 m 50 sec
Reputation Power: 7
|
|
Quote: | Originally Posted by E-Oreo It's not physically possible to have fewer cores than processors. It's hard to tell from just seeing the "core id" lines, but my guess is that your old host was a single processor system with 2 physical cores with hyper-threading. |
Here are outputs of few commands that i know - > OLD HOST
PHP Code:
grep 'cpu cores' /proc/cpuinfo
cpu cores : 2
cpu cores : 2
cpu cores : 2
cpu cores : 2
PHP Code:
grep CPU /proc/cpuinfo
model name : Intel(R) Xeon(R) CPU 5150 @ 2.66GHz
model name : Intel(R) Xeon(R) CPU 5150 @ 2.66GHz
model name : Intel(R) Xeon(R) CPU 5150 @ 2.66GHz
model name : Intel(R) Xeon(R) CPU 5150 @ 2.66GHz
PHP Code:
grep processor /proc/cpuinfo
processor : 0
processor : 1
processor : 2
processor : 3
PHP Code:
grep core\ id /proc/cpuinfo | grep -c \ 0$ | grep ^0$ >> /dev/null && grep -c processor /proc/cpuinfo || grep core\ id /proc/cpuinfo | grep -c \ 0$
2
PHP Code:
grep -c processor /proc/cpuinfo
4
PHP Code:
cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU 5150 @ 2.66GHz
stepping : 6
cpu MHz : 2666.664
cache size : 4096 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca lahf_lm dts tpr_shadow
bogomips : 5319.54
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU 5150 @ 2.66GHz
stepping : 6
cpu MHz : 2666.664
cache size : 4096 KB
physical id : 3
siblings : 2
core id : 0
cpu cores : 2
apicid : 6
initial apicid : 6
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca lahf_lm dts tpr_shadow
bogomips : 5320.05
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU 5150 @ 2.66GHz
stepping : 6
cpu MHz : 2666.664
cache size : 4096 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca lahf_lm dts tpr_shadow
bogomips : 5320.03
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU 5150 @ 2.66GHz
stepping : 6
cpu MHz : 2666.664
cache size : 4096 KB
physical id : 3
siblings : 2
core id : 1
cpu cores : 2
apicid : 7
initial apicid : 7
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca lahf_lm dts tpr_shadow
bogomips : 5320.03
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
Quote: | Originally Posted by E-Oreo
It means the process has spent 137 minutes and 31.72 seconds of the processor's time. If the processor has 2 cores, then for every 1 minute of real time the processor has 2 minutes of processor time available. |
Is it normal to be so high ? For example just now it's 147:01.69 mysqld. It's calculated starting last restart or for any period of time.
Thank you very much
|

June 13th, 2012, 06:05 PM
|
|
Contributing User
|
|
Join Date: Feb 2004
Location: San Francisco Bay
|
|
Quote: | Originally Posted by alexo Is it normal to be so high ? For example just now it's 147:01.69 mysqld. It's calculated starting last restart or for any period of time. | I don't understand your last sentence. The time value is per-process, so if you were to kill mysqld and restart it, the time would restart from 0:00.00.
mysqld is the MySQL server daemon. A daemon is a program that runs in the background, usually providing a particular service (in this case, access to your MySQL database). A daemon runs in the background for an arbitrary amount of time, potentially accruing CPU time as it goes, so your question about whether your particular running time value is "normal" doesn't really make sense. mysqld could have been running on that server for years, for all we know.
From your posts in this thread, I gather that you're running a database-heavy website that is eating a lot of your server's CPU time. Unfortunately, this is something I know nothing about. Good luck...
|

June 13th, 2012, 11:32 PM
|
 |
Lost in code
|
|
|
|
|
The 5150 is actually a dual core processor without hyper threading, so your old host must have had a dual processor system with two 5150's for a total of four cores.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|