Re: dtrace users opinion solicited (timestamps)

From: Tim Kientzle <kientzle_at_freebsd.org>
Date: Thu, 09 Jul 2009 19:54:13 -0700
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
Received on Fri Jul 10 2009 - 00:54:15 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:51 UTC