The power profiling is necessary to make estimation about charging and discharging profile. There few ways to get a accurate measurement. I know two methods to do it,
1) Directly measure battery voltage and current using a very small (10-30mohm) sense resistor.
2) Directly measure battery voltage and current from charging IC using I2C interface.
3) Reading battery voltage and current from android
Method 1 is the most reliable and accurate way, however requires some hardware modification. Method 2 is time consuming and limited by the manufacturer support. Most of the battery charger IC support I2C interface and has user access to the necessary registers. You need to go through in the datasheet to find the necessary registers. This might take sometime to write a workable script.
Method 3 is a quick and easiest way to make a Android power profile. However, I am not sure how accurate it is. Android system has a power_supply directory where it store all the power information. I wrote a small batch script to read those android files and redirect them to a text file. During discharging, ADB using USB will not work as the same usb cable charge the unit. I use adb over tcp to over come this problem. I also read CPU temperature in this script. Here is the code,