From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 15 17:50:41 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5D5EF16A40F for ; Fri, 15 Dec 2006 17:50:41 +0000 (UTC) (envelope-from joseph.koshy@gmail.com) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.190]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6123743CB9 for ; Fri, 15 Dec 2006 17:48:55 +0000 (GMT) (envelope-from joseph.koshy@gmail.com) Received: by nf-out-0910.google.com with SMTP id x37so1137811nfc for ; Fri, 15 Dec 2006 09:50:36 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=tCcEDWxPSfvtHnsdU/JLsrjBkK99FjNCjicrzKvVIlfk+HYnhBwY2/LIYra8DZIXO0mQt8FpY36v68Ecbwonci0fWJQjYmicMGqgE6ybDxaAMdkG7MLSk6kSyNGklLVTGCB+Bba1n+gruiBCHqDZc+WejGPPYupunPsqsFGFZOk= Received: by 10.49.65.19 with SMTP id s19mr2921522nfk.1166205036555; Fri, 15 Dec 2006 09:50:36 -0800 (PST) Received: by 10.78.132.9 with HTTP; Fri, 15 Dec 2006 09:50:36 -0800 (PST) Message-ID: <84dead720612150950p33c9c35erffe4adbab7227e68@mail.gmail.com> Date: Fri, 15 Dec 2006 23:20:36 +0530 From: "Joseph Koshy" To: mldodson@houston.rr.com In-Reply-To: <200612141437.28724.mldodson@houston.rr.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200612141437.28724.mldodson@houston.rr.com> Cc: freebsd-hackers@freebsd.org Subject: Re: "Syncing cpus" on a multi-cpu, dual core system X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Dec 2006 17:50:41 -0000 > frequency but something else in addition. A posting in the > thread said variations less than 0.1% were not problematic. > However, the poster said it was an issue in a dual cpu, dual > core system he had set up. Why would application code care about CPU frequencies? Is it trying to measure its 'performance' by subtracting two TSC readings? That won't necessarily work on modern multi-CPU systems where each CPU could be running at a different CPU speed. On FreeBSD, with hwpmc(4), you can allocate a process-mode counting pmc that counts non-sleep cycles (e.g., "p4-global-power-events,mask=running" on an Intel P4) and then use RDPMC instructions where you would have used RDTSC instructions. This is as cheap as the RDTSC technique and will work on SMP systems. -- FreeBSD Volunteer, http://people.freebsd.org/~jkoshy/