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

Added support for reading the max multiplier

git-svn-id: https://svn.code.sf.net/p/libcpuid/code/HEAD/libcpuid@74 3b4be424-7ac5-41d7-8526-f4ddcb85d872
This commit is contained in:
Veselin Georgiev 2009-10-02 09:14:45 +00:00
parent 277eb73da7
commit b0092bd84e
2 changed files with 8 additions and 2 deletions

View file

@ -411,7 +411,8 @@ static void print_info(output_data_switch query, struct cpu_raw_data_t* raw,
} else { } else {
fprintf(fout, "mperf = %d\n", cpu_msrinfo(handle, INFO_MPERF)); fprintf(fout, "mperf = %d\n", cpu_msrinfo(handle, INFO_MPERF));
fprintf(fout, "aperf = %d\n", cpu_msrinfo(handle, INFO_APERF)); fprintf(fout, "aperf = %d\n", cpu_msrinfo(handle, INFO_APERF));
fprintf(fout, "cpu:fsb = %.1f\n", cpu_msrinfo(handle, INFO_CUR_MULTIPLIER) / 100.0f); fprintf(fout, "current cpu:fsb = %.1f\n", cpu_msrinfo(handle, INFO_CUR_MULTIPLIER) / 100.0f);
fprintf(fout, "max cpu:fsb = %.1f\n", cpu_msrinfo(handle, INFO_MAX_MULTIPLIER) / 100.0f);
cpu_msr_driver_close(handle); cpu_msr_driver_close(handle);
} }
break; break;

View file

@ -389,9 +389,14 @@ int cpu_msrinfo(struct msr_driver_t* handle, cpu_msrinfo_request_t which)
{ {
err = cpu_rdmsr(handle, 0x2a, &r); err = cpu_rdmsr(handle, 0x2a, &r);
if (err) return CPU_INVALID_VALUE; if (err) return CPU_INVALID_VALUE;
return (int) ((r >> 22) & 0x3f) * 100; return (int) ((r>>22) & 0x1f) * 100;
} }
case INFO_MAX_MULTIPLIER: case INFO_MAX_MULTIPLIER:
{
err = cpu_rdmsr(handle, 0x198, &r);
if (err) return CPU_INVALID_VALUE;
return (int) ((r >> 40) & 0x1f) * 100;
}
case INFO_TEMPERATURE: case INFO_TEMPERATURE:
case INFO_THROTTLING: case INFO_THROTTLING:
default: default: