Edwin Law wrote:
>
> I am not sure if it is appropriate here, but I have attached here the
> small program I used for me tests, in case it is due to a bug in the
> program (which is quite probable). The switch driver I am using is 4.1.0.
> The Sun's are running Solaris 2.5.1. The Qos parameters are stated in the
> program.
>
[program snippet snipped]
> struct timeval start, finish;
>
> void start_timer() {
> gettimeofday(&start, (struct timezone*)0);
> }
>
> double stop_timer() {
> long time;
>
> gettimeofday(&finish, (struct timezone*)0);
> time = (finish.tv_sec - start.tv_sec) * 1000000 +
> finish.tv_usec - start.tv_usec;
> return (double) time / 1000000;
> }
This is suspicious on the first look:
1. tv_usec is likely to wrap around quite often, so you can't simply
subtract the numbers.
2. Is this scaling correct? You're scaling the "tv_sec" member and not
the usec-member?!
Martin
-- borriss@os.inf.tu-dresden.de borriss@mindless.com