- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Kenan,
the "energy_units" above does not give you energy consumption yet. It is a conversion constant. You need to multiply readings from additional PKG_ENERGY_STATUS MSR by "energy_units" to get the current value of the energy counter in Joules. The difference between two PKG_ENERGY_STATUS readings gives you energy consumption between the readings. Be aware: The width of PKG_ENERGY_STATUS is just 32 bit, so it may overflow, but you can handle it knowing the that the counter is 32 bit and if overflown only once. The Intel Software Development Manual has a few chapters describing these and other details of RAPL including DRAM RAPL.
Roman
![](/skins/images/C4F7392A5C68ACA60290C9576F107044/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page