diff --git a/libcpuid/rdtsc.c b/libcpuid/rdtsc.c index 75c93ba..46eb26b 100644 --- a/libcpuid/rdtsc.c +++ b/libcpuid/rdtsc.c @@ -243,7 +243,6 @@ int cpu_clock_by_ic(int millis, int runs) int max_value = 0, cur_value, i, ri, cycles_inner, cycles_outer, c; struct cpu_id_t* id; uint64_t t0, t1, tl, hz; - int num_instructions = 256; int sse_multiplier = 1; if (millis <= 0 || runs <= 0) return -2; id = get_cached_cpuid(); @@ -279,7 +278,7 @@ int cpu_clock_by_ic(int millis, int runs) } while (t1 - t0 < tl * (uint64_t) 8); // cpu_Hz = cycles_inner * cycles_outer * 256 / (t1 - t0) * 1000000 debugf(2, "c = %d, td = %llu\n", c, t1 - t0); - hz = ((uint64_t) cycles_inner * (uint64_t) num_instructions + 8) * + hz = ((uint64_t) cycles_inner * (uint64_t) 256 + 12) * (uint64_t) cycles_outer * (uint64_t) sse_multiplier * (uint64_t) c * (uint64_t) 1000000 / (t1 - t0); cur_value = (int) (hz / 1000000);