mirror of
https://github.com/anrieff/libcpuid
synced 2025-07-02 14:04:15 +00:00
Added cpu_clock_by_ic() function to measure cpu clock using instruction counting. Still not translated to MSVC, and isn't tested on CPUs other than Core i7 (but there it works beatifully). Bumped version to 0.1.3.
git-svn-id: https://svn.code.sf.net/p/libcpuid/code/HEAD/libcpuid@77 3b4be424-7ac5-41d7-8526-f4ddcb85d872
This commit is contained in:
parent
af2c364e85
commit
44c313126b
14 changed files with 444 additions and 36 deletions
|
@ -83,6 +83,7 @@ typedef enum {
|
|||
NEED_CLOCK,
|
||||
NEED_CLOCK_OS,
|
||||
NEED_CLOCK_RDTSC,
|
||||
NEED_CLOCK_IC,
|
||||
NEED_RDMSR,
|
||||
} output_data_switch;
|
||||
|
||||
|
@ -133,6 +134,7 @@ matchtable[] = {
|
|||
{ NEED_CLOCK , "--clock" , 0},
|
||||
{ NEED_CLOCK_OS , "--clock-os" , 0},
|
||||
{ NEED_CLOCK_RDTSC , "--clock-rdtsc" , 1},
|
||||
{ NEED_CLOCK_IC , "--clock-ic" , 1},
|
||||
{ NEED_RDMSR , "--rdmsr" , 0},
|
||||
};
|
||||
|
||||
|
@ -404,6 +406,9 @@ static void print_info(output_data_switch query, struct cpu_raw_data_t* raw,
|
|||
case NEED_CLOCK_RDTSC:
|
||||
fprintf(fout, "%d\n", cpu_clock_measure(400, 1));
|
||||
break;
|
||||
case NEED_CLOCK_IC:
|
||||
fprintf(fout, "%d\n", cpu_clock_by_ic(25, 16));
|
||||
break;
|
||||
case NEED_RDMSR:
|
||||
{
|
||||
if ((handle = cpu_msr_driver_open()) == NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue