From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 27 16:23:48 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 54E8516A420 for ; Mon, 27 Feb 2006 16:23:48 +0000 (GMT) (envelope-from joseph.koshy@gmail.com) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.202]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4527743D98 for ; Mon, 27 Feb 2006 16:23:30 +0000 (GMT) (envelope-from joseph.koshy@gmail.com) Received: by xproxy.gmail.com with SMTP id i30so590566wxd for ; Mon, 27 Feb 2006 08:23:29 -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=XL4XXRRzoYbWhbxMtzya5beJPgVqZULvnNtqRQq+cBCvHjwNFpJtM4P7LRt/efXNIZ/QBz+hWb2i+p9MoiXtjknnjxS8AopynLiZaQmSAUMjR63NAj2TWzhWAd0jbeznBG8OhgA9cAHtA4FS7DLKNt3v9Z5gbEUE4665+ljDQko= Received: by 10.70.54.20 with SMTP id c20mr544461wxa; Mon, 27 Feb 2006 08:23:29 -0800 (PST) Received: by 10.70.116.16 with HTTP; Mon, 27 Feb 2006 08:23:29 -0800 (PST) Message-ID: <84dead720602270823s34c18107te6e45a413dec5da7@mail.gmail.com> Date: Mon, 27 Feb 2006 21:53:29 +0530 From: "Joseph Koshy" To: "Vlad GALU" In-Reply-To: <79722fad0602270809p2229db83i5cb4cf0b24f91828@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <79722fad0602270809p2229db83i5cb4cf0b24f91828@mail.gmail.com> Cc: freebsd hackers Subject: Re: Fastest timecounter ? 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: Mon, 27 Feb 2006 16:23:48 -0000 vg> I wrote a piece of software that has to get the current vg> timestamp, one way or the other, a huge number of times per vg> second. Apart from the empyrical tests one can perform to vg> find out the timekeeping scheme with the less performance vg> impact, is there any rule of thumb as to what choice to go vg> for ? vg> Any kind of advice is most welcome, especially reading vg> material. vg> P.S. I know that some of you may say that calling vg> gettimeofday() that often is braindead, and at some vg> point I agree. Unfortunatley, right now I can't do vg> anything better. I need timekeeping to comb the vg> algorithms that deal with my data structures a bit more, vg> after which I can switch to time-related optimizations. If you just want a relative count (i.e., not absolute time) and if your machine's aren't going to be in sleep modes, you could use the RDTSC instruction directly. -- FreeBSD Volunteer, http://people.freebsd.org/~jkoshy