From owner-freebsd-current@FreeBSD.ORG Tue Oct 25 18:20:25 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF25010656A8; Tue, 25 Oct 2011 18:20:25 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 580408FC13; Tue, 25 Oct 2011 18:20:25 +0000 (UTC) Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p9PIK05Z012116 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 25 Oct 2011 21:20:00 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from alf.home (kostik@localhost [127.0.0.1]) by alf.home (8.14.5/8.14.5) with ESMTP id p9PIK0kv094645; Tue, 25 Oct 2011 21:20:00 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by alf.home (8.14.5/8.14.5/Submit) id p9PIK0VT094644; Tue, 25 Oct 2011 21:20:00 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 25 Oct 2011 21:20:00 +0300 From: Kostik Belousov To: John Baldwin Message-ID: <20111025182000.GU50300@deviant.kiev.zoral.com.ua> References: <20111025150622.GA7462@onelab2.iet.unipi.it> <201110251342.45194.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1vbNym9KGxCl/IZ3" Content-Disposition: inline In-Reply-To: <201110251342.45194.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-current@freebsd.org, Luigi Rizzo Subject: Re: getting the cpuid for a userspace process ? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Oct 2011 18:20:26 -0000 --1vbNym9KGxCl/IZ3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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) >=20 > Not from userland, no. On x86 you can use cpuid to fetch the APIC ID, bu= t=20 > 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. --1vbNym9KGxCl/IZ3 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk6m/c8ACgkQC3+MBN1Mb4j1dgCg6hOi9CjFs6lPOrYRDQ84Ti5z BGgAoNh8CTsfH2Jw+7JXvGg4/dzyzkXz =pMon -----END PGP SIGNATURE----- --1vbNym9KGxCl/IZ3--