The following changes since commit 539e9a14f8c734a5a0264309dca96cfc5d71abda: Fio 2.0.12.2 (2012-12-20 15:19:57 +0100) are available in the git repository at: git://git.kernel.dk/fio.git master Jens Axboe (3): Include <stdint.h> before checking __WORDSIZE t/axmap: update tester for lfsr_init() taking a seed argument clock: turn expensive division into multiply + cheap division arch/arch.h | 2 ++ gettime.c | 5 ++++- t/axmap.c | 8 ++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) --- Diff of recent changes: diff --git a/arch/arch.h b/arch/arch.h index 3ee5ac4..f6a8e99 100644 --- a/arch/arch.h +++ b/arch/arch.h @@ -1,6 +1,8 @@ #ifndef ARCH_H #define ARCH_H +#include <stdint.h> + #ifdef __WORDSIZE #define BITS_PER_LONG __WORDSIZE #else diff --git a/gettime.c b/gettime.c index 035d275..df329f6 100644 --- a/gettime.c +++ b/gettime.c @@ -15,6 +15,7 @@ #ifdef ARCH_HAVE_CPU_CLOCK static unsigned long cycles_per_usec; +static unsigned long inv_cycles_per_usec; int tsc_reliable = 0; #endif @@ -177,7 +178,7 @@ void fio_gettime(struct timeval *tp, void fio_unused *caller) } else if (tv) tv->last_cycles = t; - usecs = t / cycles_per_usec; + usecs = (t * inv_cycles_per_usec) / 16777216UL; tp->tv_sec = usecs / 1000000; tp->tv_usec = usecs % 1000000; break; @@ -277,6 +278,8 @@ static void calibrate_cpu_clock(void) dprint(FD_TIME, "mean=%f, S=%f\n", mean, S); cycles_per_usec = avg; + inv_cycles_per_usec = 16777216UL / cycles_per_usec; + dprint(FD_TIME, "inv_cycles_per_usec=%lu\n", inv_cycles_per_usec); } #else static void calibrate_cpu_clock(void) diff --git a/t/axmap.c b/t/axmap.c index 1f8c3e9..3f6043d 100644 --- a/t/axmap.c +++ b/t/axmap.c @@ -26,13 +26,17 @@ int main(int argc, char *argv[]) struct fio_lfsr lfsr; size_t size = (1UL << 28) - 200; struct axmap *map; + int seed = 1; - if (argc > 1) + if (argc > 1) { size = strtoul(argv[1], NULL, 10); + if (argc > 2) + seed = strtoul(argv[2], NULL, 10); + } printf("Using %llu entries\n", (unsigned long long) size); - lfsr_init(&lfsr, size); + lfsr_init(&lfsr, size, seed); map = axmap_new(size); while (size--) { -- To unsubscribe from this list: send the line "unsubscribe fio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html