Increase CPU clock calibration accuracy
[fio.git] / gettime.c
index 89a3a016e4c871a767365f96318392a65ec30ba6..549c35e9c0dc34826a69108e202f169ddffead05 100644 (file)
--- 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);
 
                gettimeofday(&e, NULL);
                elapsed = utime_since(&s, &e);
-               if (elapsed >= 10) {
+               if (elapsed >= 1280) {
                        c_e = get_cpu_clock();
                        break;
                }
        } while (1);
 
                        c_e = get_cpu_clock();
                        break;
                }
        } while (1);
 
-       return c_e - c_s;
+       return (c_e - c_s) >> 7;
 }
 
 #define NR_TIME_ITERS  50
 }
 
 #define NR_TIME_ITERS  50