Re: Fastest timecounter ?

2006-02-28 Thread David Malone
On Mon, Feb 27, 2006 at 06:09:26PM +0200, Vlad GALU wrote:
  I wrote a piece of software that has to get the current
 timestamp, one way or the other, a huge number of times per second.
 Apart from the empyrical tests one can perform to find out the
 timekeeping scheme with the less performance impact, is there any rule
 of thumb as to what choice to go for ?

The TSC is always fastest, but unfortunately under some circumstances
it can't be trusted (if your CPU has throttle modes to save power
or on some SMP systems where the two TSCs in each CPU give different
values).

David.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Re: Fastest timecounter ?

2006-02-28 Thread Sergey Babkin
From: David Malone [EMAIL PROTECTED]

The TSC is always fastest, but unfortunately under some circumstances
it can't be trusted (if your CPU has throttle modes to save power
or on some SMP systems where the two TSCs in each CPU give different
values).

If I remember correctly, all the SMP CPUs on the same
bus should give the same values (since they are
synchronized and reset from the same signals).
The discrepancy may appear on machines with
multiple bridged front-side buses, essentially the
NUMA machines (such as those with over 4 Intel CPUs).

-SB
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Fastest timecounter ?

2006-02-27 Thread Joseph Koshy
vg I wrote a piece of software that has to get the current
vg timestamp, one way or the other, a huge number of times per
vg second. Apart from the empyrical tests one can perform to
vg find out the timekeeping scheme with the less performance
vg impact, is there any rule of thumb as to what choice to go
vg for ?

vg Any kind of advice is most welcome, especially reading
vg material.

vg P.S. I know that some of you may say that calling
vg gettimeofday() that often is braindead, and at some
vg point I agree. Unfortunatley, right now I can't do
vg anything better. I need timekeeping to comb the
vg algorithms that deal with my data structures a bit more,
vg after which I can switch to time-related optimizations.

If you just want a relative count (i.e., not absolute
time) and if your machine's aren't going to be in sleep
modes, you could use the RDTSC instruction directly.

--
FreeBSD Volunteer, http://people.freebsd.org/~jkoshy
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]