Display Number of Processors on Linux Display Number of Processors Linux
If you've just upgraded your Linux box, or you are wondering how many processors a remote server has, there's a quick and dirty command you can use to display the number of processors. Ja esat tikko modernizētas jūsu Linux box, vai jums ir jautājums, cik procesori attālajā serverī ir, ka ir ātrs un netīrās komanda var izmantot, lai parādītu pārstrādātāju skaitu.
On Linux, /proc/cpuinfo contains all of the processor information for all current processors in your computer. Linux, / proc / cpuinfo satur visus procesora informācija par visiem esošajiem pārstrādātājiem datoru. This will include the speed, the amount of on-chip cache, processor type, and how many cores. Tas ietvers ātrumu, summa on-chip cache, procesora viedu un cik serdes.
Here's the command: Šeit ir komandu:
cat /proc/cpuinfo | grep processor | wc -l cat / proc / cpuinfo | grep Processor | wc-l
The command just looks in the /proc/cpuinfo file, pulls out the number of lines containing the word “processor” and passes them into wc (word count), which returns a count of the CPUs in the system. Komanda tikai izskatās in / proc / cpuinfo failu, atvelk no rindu skaitu, kas satur vārdu "pārstrādātājs" un nodod tos wc (Word count), kas atgriež skaits šajā sistēmā CPU.
Here's what it returned on my remote server: Lūk, kā tas atgriezās savā attālajā serverī:
[root@root]# cat /proc/cpuinfo | grep processor | wc -l [root @ root] # cat / proc / cpuinfo | grep Processor | wc-l
4 4
Note that if you have a dual-core processor, it will return each core as a separate processor. Ņemiet vērā, ka, ja jums ir divkodolu procesors, tā atgriezīsies katru kodols kā atsevišķu procesoru. You can look at the full output of cat /proc/cpuinfo to see if the chips are dual-core. Jūs varat apskatīt pilnu izejas cat / proc / cpuinfo lai redzētu, vai mikroshēmas Dual-Core.

Daily Email Updates Daily Email Updates
You can get our how-to articles in your inbox each day for free. Jūs varat saņemt mūsu how-to rakstus savā pastkastītē katru dienu par brīvu. Just enter your name and email below: Vienkārši ievadiet jūsu vārdu un e-pasta zemāk:



Hi, Čau,
this will give you the same result and saves you having to type a couple of characters Tas dos Jums tādu pašu rezultātu un saglabā tev ierakstīt pāris characters
grep processor /proc/cpuinfo |wc -l grep processor / proc / cpuinfo | wc-l
This will save you a pipe Tas ietaupīs jums pipe
grep -c processor /proc/cpuinfo grep-c processor / proc / cpuinfo
Won't this count CPUs with hyperthreading twice? Nebūs šis skaits CPU ar hyperthreading divreiz? My computer has one Pentium 4 (Prescott) CPU, but has two processor entries in cpuinfo. Mans dators ir viens Pentium 4 (Prescott) CPU, bet ir divas procesoru ieraksti cpuinfo.
Well… Sorry to say that it doesn't work most of the time. Nu ... Piedodiet teikt, ka tas nedarbojas lielākā daļa laika. Beside multithreadin processors, It is common that entry on a single processor has multiple occurence of word “processor” (both in the procesor identifier and model name. Blakus multithreadin procesori ir skaidrs, ka ieraksts par vienu procesoru ir vairāki notikums vārdu "pārstrādātājs" (abas Procesor identifikators un modeļa nosaukumu.
On my ancient pemtium M laptop it reports 2 processors because ist modelname is “Intel(R) Pentium(R) M processor 1.73GHz”. Uz manu seno pemtium M klēpjdators tas ziņo, 2 procesori, jo ist Modelis ZUIKO DIGITAL ir "Intel (R) Pentium (R) M processor 1.73GHz".
This might help: Tas varētu palīdzēt:
grep -c ^processor /proc/cpuinfo grep-c ^ processor / proc / cpuinfo
To get the count of physical CPUs, this works by counting the unique physical ids Lai iegūtu skaits fizisko CPU, tas, skaitot unikālo fizisko ID darbi
grep “physical id” /proc/cpuinfo |sort -u|wc -l grep "fiziskā id" / proc / cpuinfo | sort-u | wc-l
This comment I wrote may also help you (it's actually for Linux): Šo komentāru es uzrakstīju, arī var palīdzēt jums (tas patiesībā Linux): http://www.howtogeek.com/howto.....ment-64380 http://www.howtogeek.com/howto.....ment-64380