From intel software developer manual 3b, I came to know MSR (10H) equal to RDTSC. So I wanted to verify it using piece of code as follows in my program:
But when I run my program it showed segmentation fault. Then a realized the caution that it work only in privilege level 0. So I run the program again with sudo access. This time the program ran without seg fault but the statement after asm volatile(..) are not getting executed. Even it dint work out.
What shall I do to make rdmsr work in my program?
(I am using linux on i7 core which supports these counters. I verified it.)
I don't know whether there is a WindowsOS native way to access the MSRs, probably through some debugging interface or such.
You can use the Windows driver from Intel PCM https://github.com/opcm/pcm to get an interface to the user space. For further information see the Windows HOWTO https://github.com/opcm/pcm/blob/master/WINDOWS_HOWTO.rtf
Here is also a link with some explanations how to install the driver: https://software.intel.com/en-us/forums/software-tuning-performance-optimization-platform-monitoring...