1
0
Fork 0
mirror of https://github.com/anrieff/libcpuid synced 2024-11-10 22:59:13 +00:00

A small correction

git-svn-id: https://svn.code.sf.net/p/libcpuid/code/HEAD/libcpuid@83 3b4be424-7ac5-41d7-8526-f4ddcb85d872
This commit is contained in:
Veselin Georgiev 2010-04-20 10:03:03 +00:00
parent b922a5b29c
commit a7a45d8efb

View file

@ -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; int max_value = 0, cur_value, i, ri, cycles_inner, cycles_outer, c;
struct cpu_id_t* id; struct cpu_id_t* id;
uint64_t t0, t1, tl, hz; uint64_t t0, t1, tl, hz;
int num_instructions = 256;
int sse_multiplier = 1; int sse_multiplier = 1;
if (millis <= 0 || runs <= 0) return -2; if (millis <= 0 || runs <= 0) return -2;
id = get_cached_cpuid(); id = get_cached_cpuid();
@ -279,7 +278,7 @@ int cpu_clock_by_ic(int millis, int runs)
} while (t1 - t0 < tl * (uint64_t) 8); } while (t1 - t0 < tl * (uint64_t) 8);
// cpu_Hz = cycles_inner * cycles_outer * 256 / (t1 - t0) * 1000000 // cpu_Hz = cycles_inner * cycles_outer * 256 / (t1 - t0) * 1000000
debugf(2, "c = %d, td = %llu\n", c, t1 - t0); 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 (uint64_t) cycles_outer * (uint64_t) sse_multiplier * (uint64_t) c * (uint64_t) 1000000
/ (t1 - t0); / (t1 - t0);
cur_value = (int) (hz / 1000000); cur_value = (int) (hz / 1000000);