lkml.org 
[lkml]   [2002]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: How to get number of physical CPU in linux from user space?
    On Thu, Oct 24, 2002 at 04:02:29PM -0700, chrisl@vmware.com wrote:
    > It seems that /proc/cpuinfo will return the number of logical CPU.
    > If the machine has Intel Hyper-Thread enabled, that number is bigger
    > than physical CPU number. Usually twice as big.
    >
    > My question is, what is the reliable way for user space program
    > to detect the number of physical CPU in the current machine?
    >
    > If in it is in the kernel, I can read from cpu_sibling_map[]
    > or phys_cpu_id[]. But it seems not easy read that from
    > user space.
    >
    > Of course I can do "gdb /proc/kcore" to get them. But is there
    > any better way?

    You can perform cpuid instructions in userspace to get the
    number of siblings per physical package.

    --
    | Dave Jones. http://www.codemonkey.org.uk
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:30    [W:4.703 / U:0.248 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site