diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-11-25 23:05:43 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:06:10 -0500 |
commit | b6b01064279c0cf5bae8b2324c760f1f7f6be457 (patch) | |
tree | cbd19dcceca038b6192dca44c46189d94da234e8 /source4/lib | |
parent | d019557a53b7e624724cd23cce025731c9808f50 (diff) | |
download | samba-b6b01064279c0cf5bae8b2324c760f1f7f6be457.tar.gz samba-b6b01064279c0cf5bae8b2324c760f1f7f6be457.tar.bz2 samba-b6b01064279c0cf5bae8b2324c760f1f7f6be457.zip |
r3976: changed NBENCH to use the same recording method as the latest dbench,
where the warmup phase continues until all clients have done some file
IO. This gives more repeatable results when under high load
(This used to be commit aca0658f6dfe8b7c90afcac87e8cc68965a4288d)
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/time.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/source4/lib/time.c b/source4/lib/time.c index b13ad24b34..8d477fac02 100644 --- a/source4/lib/time.c +++ b/source4/lib/time.c @@ -477,13 +477,21 @@ BOOL timeval_expired(struct timeval *tv) } /* + return the number of seconds elapsed between two times +*/ +double timeval_elapsed2(struct timeval *tv1, struct timeval *tv2) +{ + return (tv2->tv_sec - tv1->tv_sec) + + (tv2->tv_usec - tv1->tv_usec)*1.0e-6; +} + +/* return the number of seconds elapsed since a given time */ double timeval_elapsed(struct timeval *tv) { struct timeval tv2 = timeval_current(); - return (tv2.tv_sec - tv->tv_sec) + - (tv2.tv_usec - tv->tv_usec)*1.0e-6; + return timeval_elapsed2(tv, &tv2); } /* @@ -498,6 +506,17 @@ struct timeval timeval_min(struct timeval *tv1, struct timeval *tv2) } /* + return the greater of two timevals +*/ +struct timeval timeval_max(struct timeval *tv1, struct timeval *tv2) +{ + if (tv1->tv_sec > tv2->tv_sec) return *tv1; + if (tv1->tv_sec < tv2->tv_sec) return *tv2; + if (tv1->tv_usec > tv2->tv_usec) return *tv1; + return *tv2; +} + +/* return the difference between two timevals as a timeval if tv2 comes after tv1, then return a zero timeval (this is *tv1 - *tv2) |