Hi all,
I'm trying to use RAPL interface to get energy consumption (package/core/uncore), and I read the code below:
http://www.eece.maine.edu/~vweaver/projects/rapl/rapl_msr.c
I used it on My machine, and it works. But I'm not quite sure how accurate the result I get for this code.
For example:
sprintf(msr_filename, "/dev/cpu/%d/msr", core);
fd = open(msr_filename, O_RDONLY);
long long result = read_msr(fd, MSR_RAPL_POWER_UNIT);
energy_units = pow(0.5, (double)((result>>8)&0x1f));
How do these bit operations work for?
My CPU is I5-2410m, architecture is sandy bridge. Do you have any insights on what the problem could be? I know little on programming on the driver level.
Thank you.


