Librapl is a library that simplifies access to the RAPL values in MSR registers of modern Intel CPUs, e.g., SandyBridge or IvyBridge processors. It also contains a sample application that can either print the current energy consumption on the console or write the values with a Gnuplot-friendly format in a file. Currently it provides the consumption of the package, the CPU and GPU as well as peripheral components (uncore).
Source code: librapl on Github
Example of librapl with Gnuplot on a 4-core IvyBridge processor: