libcpuid
A simple libcpuid introduction

LibCPUID provides CPU identification and access to the CPUID and RDTSC instructions on the x86.

To execute CPUID, use cpu_exec_cpuid.
To execute RDTSC, use cpu_rdtsc.
To fetch the CPUID info needed for CPU identification, use cpuid_get_raw_data or cpuid_get_all_raw_data.
To make sense of that data (decode, extract features), use cpu_identify or cpu_identify_all.
To detect the CPU speed, use either cpu_clock, cpu_clock_by_os, cpu_tsc_mark + cpu_tsc_unmark + cpu_clock_by_mark, cpu_clock_measure, cpu_clock_by_ic or cpu_clock_by_tsc. Read carefully for pros/cons of each method.

To read MSRs, use cpu_msr_driver_open to get a handle, and then cpu_rdmsr for querying abilities. Some MSR decoding is available on recent CPUs, and can be queried through cpu_msrinfo; the various types of queries are described in cpu_msrinfo_request_t.