Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
* gettimeofday resolution
@ 2000-03-23  5:00 Alex Rhomberg
  2000-03-23  5:00 ` Alex Rhomberg
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Rhomberg @ 2000-03-23  5:00 UTC (permalink / raw)


I use gettimeofday for time measurement.
On my PWS500a with RH 6.1, kernel 2.2.12, this works fine, giving me
microsecond resolution.
A test on UP2000 with SuSE 6.1 and 2.2.13 kernel returns the time with
1ms jumps

The following program outputs 1 or 2 us on PWS/RH and 980 on UP2000/SuSE

could somebody please test this with different configs and help me find
the reason for the difference?

Thanks
Alex

#include <time.h>                               // for gettimeofday
#include <sys/time.h>
#include <stdio.h>

int main(int argc, char**argv)
{
  struct timeval  tv1, tv2;
  
  gettimeofday(&tv1, NULL);
  do {
    gettimeofday(&tv2, NULL);
  } while (tv1.tv_usec == tv2.tv_usec);

  printf("Difference: %d us\n", tv2.tv_usec - tv1.tv_usec + 
         1000000 * (tv2.tv_sec - tv1.tv_sec));

  return 0;
}



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: gettimeofday resolution
  2000-03-23  5:00 gettimeofday resolution Alex Rhomberg
@ 2000-03-23  5:00 ` Alex Rhomberg
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Rhomberg @ 2000-03-23  5:00 UTC (permalink / raw)


Alex Rhomberg wrote:
> 
> I use gettimeofday for time measurement.
> On my PWS500a with RH 6.1, kernel 2.2.12, this works fine, giving me
> microsecond resolution.
> A test on UP2000 with SuSE 6.1 and 2.2.13 kernel returns the time with
> 1ms jumps
> 
> The following program outputs 1 or 2 us on PWS/RH and 980 on UP2000/SuSE
> 
> could somebody please test this with different configs and help me find
> the reason for the difference?

Hmm, I guess I found it. No high resolution for SMP*, because we can't
trust the rpcc register. 
Can somebody give me a hint how I find a high resolution timer on an SMP
machine?

Can I increase the processor affinity somehow?

- Alex

* it's in do_gettimeofday in arch/alpha/kernel/time.c



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-03-23  5:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-03-23  5:00 gettimeofday resolution Alex Rhomberg
2000-03-23  5:00 ` Alex Rhomberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox