From owner-freebsd-current@FreeBSD.ORG Fri Jul 10 02:54:15 2009 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 7BBEC106566C for ; Fri, 10 Jul 2009 02:54:15 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: from kientzle.com (kientzle.com [66.166.149.50]) by mx1.freebsd.org (Postfix) with ESMTP id 3F2248FC19 for ; Fri, 10 Jul 2009 02:54:15 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: (from root@localhost) by kientzle.com (8.14.3/8.14.3) id n6A2sEqH022566; Thu, 9 Jul 2009 19:54:14 -0700 (PDT) (envelope-from kientzle@freebsd.org) Received: from dark.x.kientzle.com (fw2.kientzle.com [10.123.1.2]) by kientzle.com with SMTP id 62brfwiytwpmwwv7xf6zegxuea; Thu, 09 Jul 2009 19:54:13 -0700 (PDT) (envelope-from kientzle@freebsd.org) Message-ID: <4A56AD55.2010201@freebsd.org> Date: Thu, 09 Jul 2009 19:54:13 -0700 From: Tim Kientzle User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.1.21) Gecko/20090601 SeaMonkey/1.1.16 MIME-Version: 1.0 To: Andriy Gapon References: <4A562960.3010801@freebsd.org> <4A563A57.8090907@freebsd.org> In-Reply-To: <4A563A57.8090907@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Cc: =?ISO-8859-1?Q?Marius_N=FCnnerich?= , freebsd-current@freebsd.org Subject: Re: dtrace users opinion solicited (timestamps) 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: Fri, 10 Jul 2009 02:54:15 -0000 Andriy Gapon wrote: > on 09/07/2009 21:02 Marius Nünnerich said the following: >> What about atomically changing tsc_freq every time the frequency is changed? > > This is what actually does happen, but it doesn't help. > > Say, there is a moment T1 when TSC has value N and tsc_freq is X, and moment T2 > when when TSC value (N + 1) and tsc_freq is 10*X. > So the formula gives: > > t1 = N / X > t2 = (N+1) / (10*X) Instead of just storing tsc_freq at each frequency change, you really need: * Last timestamp just before frequency change (t0) * new frequency (f) * TSC value at frequency change (c0) Then t = t0 + (rdtsc() - c0) / f Of course, I haven't looked at the code to tell what your range limitations are. Tim