getting the cpuid for a userspace process ?

Kostik Belousov kostikbel at gmail.com
Tue Oct 25 18:20:26 UTC 2011


On Tue, Oct 25, 2011 at 01:42:45PM -0400, John Baldwin wrote:
> On Tuesday, October 25, 2011 11:06:22 am Luigi Rizzo wrote:
> > as the subject says... is there any way to get the current
> > CPU id for a userspace process (of course,
> > valid only at the time the function is called as the
> > process might be arbitrarily moved while it runs)
> 
> Not from userland, no.  On x86 you can use cpuid to fetch the APIC ID, but 
> that does not map 1:1 to FreeBSD cpu IDs.
Not quite so. The kern.proc sysctls do provide oncpu and lastcpu
information, which, I believe, is used by top. But this is very slow way
to get cpu id.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20111025/5b182d38/attachment.pgp


More information about the freebsd-current mailing list