[OpenAFS-devel] fileserver profiling

Tom Keiser Tom Keiser <tkeiser@gmail.com>
Sun, 13 Mar 2005 14:45:03 -0500


oops. I didn't mean to send that email quite yet...

On Sun, 13 Mar 2005 14:32:15 -0500, Tom Keiser <tkeiser@gmail.com> wrote:
> now our read time function is just:
> 
> static approx_invocations = 0;
> static approx_is_ok = 1;
> struct timeval tv;
> if (approx_is_ok) {
>   do {
>     register int idx = approx_time_cur_idx;
>     memcpy(&tv, &approx_time[idx%APPROX_GENERATIONS], sizeof(struct timeval));
>   } while (idx != approx_time_cur_idx);
>   if ((approx_invocations%100)==0) {
>     struct timeval check;
> 

    register int delta;

>     gettimeofday(&check,NULL);
> 

    delta = check.tv_sec - tv.tv_sec;
/* change your max allowed skew accordingly, or
   factor microseconds into the decision as well, if you want */
    if (delta > 3) {        
      approx_is_ok = 0;
    }
  }
  atomic_increment(&approx_invocations);
} else {
  gettimeofday(&tv,NULL);
}


> I think my code snippet above is illustrative.  At most, we should
> only need 1 read barrier:
> 
> struct timeval tv;
> register int idx;
> do {
>   idx = approx_time_cur_idx;
>   memcpy(&tv, &approx_time[idx].tv, sizeof(struct timeval));
>   read_barrier();
> } while (idx != approx_time_cur_idx);
> 

err ignore this... i meant to delete it before sending

--
Tom Keiser
tkeiser@gmail.com