The following changes since commit fa80feae51331fb170e784459fa1359d7ec3a963: Add check for invariant TSC on x86 and use TSC is default clock if reliable (2012-12-09 20:29:00 +0100) are available in the git repository at: git://git.kernel.dk/fio.git master Jens Axboe (6): Increase CPU clock calibration accuracy gettime: calibration rounding error gettime: fix CPU calibration reported mean Define TSC arch_init() for PPC and IA64 cpu clock: round up when dividing by samples Merge branch 'master' of ssh://brick.kernel.dk/data/git/fio arch/arch-ia64.h | 7 +++++++ arch/arch-ppc.h | 7 +++++++ gettime.c | 9 +++++---- 3 files changed, 19 insertions(+), 4 deletions(-) --- Diff of recent changes: diff --git a/arch/arch-ia64.h b/arch/arch-ia64.h index f4464c4..8ccbd86 100644 --- a/arch/arch-ia64.h +++ b/arch/arch-ia64.h @@ -42,6 +42,13 @@ static inline unsigned long get_cpu_clock(void) return ret; } +#define ARCH_HAVE_INIT +extern int tsc_reliable; +static inline int arch_init(char *envp[]) +{ + tsc_reliable = 1; +} + #define ARCH_HAVE_FFZ #define ARCH_HAVE_CPU_CLOCK diff --git a/arch/arch-ppc.h b/arch/arch-ppc.h index b790a55..0f20375 100644 --- a/arch/arch-ppc.h +++ b/arch/arch-ppc.h @@ -58,6 +58,13 @@ static inline unsigned long long get_cpu_clock(void) return ret; } +#define ARCH_HAVE_INIT +extern int tsc_reliable; +static inline int arch_init(char *envp[]) +{ + tsc_reliable = 1; +} + #define ARCH_HAVE_FFZ #define ARCH_HAVE_CPU_CLOCK diff --git a/gettime.c b/gettime.c index 89a3a01..1ba18e9 100644 --- a/gettime.c +++ b/gettime.c @@ -201,13 +201,13 @@ static unsigned long get_cycles_per_usec(void) gettimeofday(&e, NULL); elapsed = utime_since(&s, &e); - if (elapsed >= 10) { + if (elapsed >= 1280) { c_e = get_cpu_clock(); break; } } while (1); - return c_e - c_s; + return (c_e - c_s + 127) >> 7; } #define NR_TIME_ITERS 50 @@ -242,12 +242,13 @@ static void calibrate_cpu_clock(void) } S /= (double) NR_TIME_ITERS; - mean /= (double) NR_TIME_ITERS; + mean /= 10.0; for (i = 0; i < NR_TIME_ITERS; i++) dprint(FD_TIME, "cycles[%d]=%lu\n", i, cycles[i] / 10); - avg /= (samples * 10); + avg /= samples; + avg = (avg + 9) / 10; dprint(FD_TIME, "avg: %lu\n", avg); dprint(FD_TIME, "mean=%f, S=%f\n", mean, S); -- 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