gettime: limit warning on CPU clock
authorJens Axboe <axboe@fb.com>
Tue, 16 Dec 2014 22:37:25 +0000 (15:37 -0700)
committerJens Axboe <axboe@fb.com>
Tue, 16 Dec 2014 22:37:25 +0000 (15:37 -0700)
Signed-off-by: Jens Axboe <axboe@fb.com>
gettime.c

index 8e53f83fd3b22e368f104d683c776e8aeb6868d1..87abca0ff883f59c4850f191ae8d744128552bee 100644 (file)
--- a/gettime.c
+++ b/gettime.c
@@ -21,7 +21,8 @@ int tsc_reliable = 0;
 
 struct tv_valid {
        uint64_t last_cycles;
-       uint64_t last_tv_valid;
+       int last_tv_valid;
+       int warned;
 };
 #ifdef CONFIG_TLS_THREAD
 static __thread struct tv_valid static_tv_valid;
@@ -170,8 +171,11 @@ static void __fio_gettime(struct timeval *tp)
                uint64_t usecs, t;
 
                t = get_cpu_clock();
-               if (t < tv->last_cycles && tv->last_tv_valid)
+               if (t < tv->last_cycles && tv->last_tv_valid &&
+                   !tv->warned) {
                        log_err("fio: CPU clock going back in time\n");
+                       tv->warned = 1;
+               }
 
                tv->last_cycles = t;
                tv->last_tv_valid = 1;