1
0
Fork 0
mirror of https://github.com/anrieff/libcpuid synced 2025-07-02 14:04:15 +00:00

Add a msr_serialize_raw_data() function

This commit is contained in:
Xorg 2017-02-09 20:55:28 +01:00
parent fa87a5e183
commit 9b038c94c4
5 changed files with 113 additions and 1 deletions

View file

@ -89,6 +89,7 @@ typedef enum {
NEED_CLOCK_RDTSC,
NEED_CLOCK_IC,
NEED_RDMSR,
NEED_RDMSR_RAW,
NEED_SSE_UNIT_SIZE,
} output_data_switch;
@ -146,6 +147,7 @@ matchtable[] = {
{ NEED_CLOCK_RDTSC , "--clock-rdtsc" , 1},
{ NEED_CLOCK_IC , "--clock-ic" , 1},
{ NEED_RDMSR , "--rdmsr" , 0},
{ NEED_RDMSR_RAW , "--rdmsr-raw" , 0},
{ NEED_SSE_UNIT_SIZE, "--sse-size" , 1},
};
@ -460,6 +462,16 @@ static void print_info(output_data_switch query, struct cpu_raw_data_t* raw,
}
break;
}
case NEED_RDMSR_RAW:
{
if ((handle = cpu_msr_driver_open()) == NULL) {
fprintf(fout, "Cannot open MSR driver: %s\n", cpuid_error());
} else {
msr_serialize_raw_data(handle, "");
cpu_msr_driver_close(handle);
}
break;
}
case NEED_SSE_UNIT_SIZE:
{
fprintf(fout, "%d (%s)\n", data->sse_size,