Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From <code>man 5 proc</code>:</p> <blockquote> <pre><code> /proc/cpuinfo This is a collection of CPU and system architecture dependent items, for each supported architecture a different list. Two common entries are processor which gives CPU number and bogomips; a system constant that is calculated during kernel initialization. SMP machines have information for each CPU. </code></pre> </blockquote> <p>Here is sample code that reads and prints the info to console, <a href="http://www.linuxquestions.org/questions/programming-9/c-get-cmdline-from-proc-filesystem-772529/" rel="nofollow">stolen from forums</a> - It really is just a specialized <code>cat</code> command.</p> <pre><code>#define _GNU_SOURCE #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; int main(int argc, char **argv) { FILE *cpuinfo = fopen("/proc/cpuinfo", "rb"); char *arg = 0; size_t size = 0; while(getdelim(&amp;arg, &amp;size, 0, cpuinfo) != -1) { puts(arg); } free(arg); fclose(cpuinfo); return 0; } </code></pre> <p>Please note that you need to parse and compare the <code>physical id</code>, <code>core id</code> and <code>cpu cores</code> to get an accurate result, if you really care about the number of CPUs vs. CPU cores. Also please note that if there is a <code>htt</code> in <code>flags</code>, you are running a hyper-threading CPU, which means that your mileage may vary.</p> <p>Please also note that if you run your kernel in a virtual machine, you only see the CPU cores dedicated to the VM guest.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload