summaryrefslogtreecommitdiff
path: root/gettime.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-12-16 15:37:25 -0700
committerJens Axboe <axboe@fb.com>2014-12-16 15:37:25 -0700
commit02dcf81c05b90bf50c062545a4b1158bca75950b (patch)
tree9ac3bb107c6be4a9d2b50ae5e458c065d22113cb /gettime.c
parent9eb271b9deb3f2ec4ff78fd6391176a897b09329 (diff)
downloadfio-02dcf81c05b90bf50c062545a4b1158bca75950b.tar.gz
fio-02dcf81c05b90bf50c062545a4b1158bca75950b.tar.bz2
gettime: limit warning on CPU clock
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'gettime.c')
-rw-r--r--gettime.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gettime.c b/gettime.c
index 8e53f83f..87abca0f 100644
--- 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;