mirror of
https://github.com/anrieff/libcpuid
synced 2024-12-16 16:35:45 +00:00
Add INFO_BCLK in cpu_msrinfo()
This commit is contained in:
parent
fc72fdee74
commit
42e8d6f019
2 changed files with 16 additions and 0 deletions
|
@ -865,6 +865,8 @@ typedef enum {
|
||||||
throttling. 0 if it is running normally. */
|
throttling. 0 if it is running normally. */
|
||||||
INFO_VOLTAGE, /*!< The current core voltage in Volt,
|
INFO_VOLTAGE, /*!< The current core voltage in Volt,
|
||||||
multiplied by 100. */
|
multiplied by 100. */
|
||||||
|
INFO_BCLK, /*!< The BCLK (base clock) in MHz,
|
||||||
|
multiplied by 100. */
|
||||||
} cpu_msrinfo_request_t;
|
} cpu_msrinfo_request_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -486,6 +486,20 @@ int cpu_msrinfo(struct msr_driver_t* handle, cpu_msrinfo_request_t which)
|
||||||
}
|
}
|
||||||
return CPU_INVALID_VALUE;
|
return CPU_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
|
case INFO_BCLK:
|
||||||
|
{
|
||||||
|
static int clock = 0, multiplier = 0;
|
||||||
|
double bclk = 0.0;
|
||||||
|
|
||||||
|
if(!clock && (clock = cpu_clock_measure(100, 1)) <= 0) // Return the non-Turbo clock
|
||||||
|
return CPU_INVALID_VALUE;
|
||||||
|
if(!multiplier && (multiplier = cpu_msrinfo(handle, INFO_MAX_MULTIPLIER) / 100) <= 0)
|
||||||
|
return CPU_INVALID_VALUE;
|
||||||
|
if((bclk = (double) clock / multiplier) > 0)
|
||||||
|
return (int) (bclk * 100);
|
||||||
|
|
||||||
|
return CPU_INVALID_VALUE;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return CPU_INVALID_VALUE;
|
return CPU_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue