X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=gettime.c;h=b89cd46fdd14e7cbe6290a424416b6268a6543d8;hp=8b3e1e5246eb5787663d51560219b6c6b0c4d7b9;hb=905e3d4ff8d01a4402186e1ad1f5f1fbbb6b7ef4;hpb=b4ea84daaf58566fe21e50d6540a8bc287d91863 diff --git a/gettime.c b/gettime.c index 8b3e1e52..b89cd46f 100644 --- a/gettime.c +++ b/gettime.c @@ -32,7 +32,7 @@ static pthread_key_t tv_tls_key; enum fio_cs fio_clock_source = FIO_PREFERRED_CLOCK_SOURCE; int fio_clock_source_set = 0; -enum fio_cs fio_clock_source_inited = CS_INVAL; +static enum fio_cs fio_clock_source_inited = CS_INVAL; #ifdef FIO_DEBUG_TIME @@ -205,7 +205,7 @@ void fio_gettime(struct timeval *tp, void fio_unused *caller) gtod_log_caller(caller); #endif - if (fio_tv) { + if (fio_unlikely(fio_tv)) { memcpy(tp, fio_tv, sizeof(*tp)); return; } @@ -327,7 +327,7 @@ void fio_local_clock_init(int is_thread) { struct tv_valid *t; - t = calloc(sizeof(*t), 1); + t = calloc(1, sizeof(*t)); if (pthread_setspecific(tv_tls_key, t)) log_err("fio: can't set TLS key\n"); } @@ -578,7 +578,7 @@ int fio_monotonic_clocktest(void) free(threads); if (failed) { - log_err("Clocksource test: %u threads failed\n", failed); + log_err("Clocksource test: %lu threads failed\n", failed); goto err; } @@ -595,9 +595,10 @@ int fio_monotonic_clocktest(void) if (prev->tsc > this->tsc) { uint64_t diff = prev->tsc - this->tsc; - log_info("cs: CPU clock mismatch (diff=%lu):\n", diff); - log_info("\t CPU%3lu: TSC=%lu, SEQ=%lu\n", prev->cpu, prev->tsc, prev->seq); - log_info("\t CPU%3lu: TSC=%lu, SEQ=%lu\n", this->cpu, this->tsc, this->seq); + log_info("cs: CPU clock mismatch (diff=%llu):\n", + (unsigned long long) diff); + log_info("\t CPU%3u: TSC=%llu, SEQ=%u\n", prev->cpu, (unsigned long long) prev->tsc, prev->seq); + log_info("\t CPU%3u: TSC=%llu, SEQ=%u\n", this->cpu, (unsigned long long) this->tsc, this->seq); failed++; }