From owner-freebsd-current@FreeBSD.ORG Thu Jul 9 19:55:29 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 CEA60106566C; Thu, 9 Jul 2009 19:55:29 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id 8E42B8FC15; Thu, 9 Jul 2009 19:55:29 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.3/8.14.2) with ESMTP id n69JdWNv054452; Thu, 9 Jul 2009 15:39:32 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.3/8.14.2/Submit) id n69JdWjr054451; Thu, 9 Jul 2009 15:39:32 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Date: Thu, 9 Jul 2009 15:39:32 -0400 From: David Schultz To: Andriy Gapon Message-ID: <20090709193932.GA54408@zim.MIT.EDU> Mail-Followup-To: Andriy Gapon , freebsd-current@FreeBSD.ORG References: <4A562960.3010801@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A562960.3010801@freebsd.org> Cc: 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: Thu, 09 Jul 2009 19:55:30 -0000 On Thu, Jul 09, 2009, Andriy Gapon wrote: > > As you might be aware DTrace timestamps right now are derived from TSC value. > http://en.wikipedia.org/wiki/Time_Stamp_Counter > > DTrace timestamps are measured in nano-seconds and the formula similar to the > following is used for calculations: > rdtsc() * 1000000000 / tsc_freq > where rdtsc is a function that returns current TSC value and tsc_freq is a > frequency of TSC. > > This formula is supposed to produce proper results if tsc_freq stays constant. > But there are environment where this might not be the case. > If a CPU has a non-invariant TSC and processor's clock frequency changes (e.g. > because of powerd), then tsc_freq changes too. > As a result, the formula would produce wildly different values and, most > importantly, was values would non be monotonic. Timestamp values that jump back > and forth would not only be useless for a user, they would also confuse DTrace > internal logic. Doesn't Solaris DTRT and compensate for TSC frequency changes? Why can't we do the same thing?