summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/raw/pingpong.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/source4/torture/raw/pingpong.c b/source4/torture/raw/pingpong.c
index f620c4854d..124cf69b64 100644
--- a/source4/torture/raw/pingpong.c
+++ b/source4/torture/raw/pingpong.c
@@ -155,21 +155,6 @@ static void read_byte(struct smbcli_state *cli, int fd, uint8_t *c, int offset)
}
}
-
-static struct timeval tp1, tp2;
-
-static void start_timer(void)
-{
- gettimeofday(&tp1, NULL);
-}
-
-static double end_timer(void)
-{
- gettimeofday(&tp2, NULL);
- return (tp2.tv_sec + (tp2.tv_usec*1.0e-6)) -
- (tp1.tv_sec + (tp1.tv_usec*1.0e-6));
-}
-
/*
ping pong
*/
@@ -187,6 +172,7 @@ bool torture_ping_pong(struct torture_context *torture)
uint8_t incr=0, last_incr=0;
uint8_t *val;
int count, loops;
+ struct timeval start;
fn = torture_setting_string(torture, "filename", NULL);
if (fn == NULL) {
@@ -219,7 +205,7 @@ bool torture_ping_pong(struct torture_context *torture)
lock_byte(cli, fd, 0, lock_timeout);
- start_timer();
+ start = timeval_current();
val = talloc_zero_array(mem_ctx, uint8_t, num_locks);
i = 0;
count = 0;
@@ -248,11 +234,11 @@ bool torture_ping_pong(struct torture_context *torture)
printf("data increment = %u\n", incr);
fflush(stdout);
}
- if (end_timer() > 1.0) {
+ if (timeval_elapsed(&start) > 1.0) {
printf("%8u locks/sec\r",
- (unsigned)(2*count/end_timer()));
+ (unsigned)(2*count/timeval_elapsed(&start)));
fflush(stdout);
- start_timer();
+ start = timeval_current();
count=0;
}
loops++;