Measuring average current consumption in hardware
If this is a 'design time' measurement to prove the system or its scheduling on the bench, then you could use a technique that I have often used in the past.

Take a large electrolytic capacitor, and I mean 10,000uF or suchlike, and use that to power the microcontroller. Record its change of voltage second by second, which multiplied by the caapcitance will give you the integrated charge that the controller has used.

Obviously every so often you will need to charge it by connecting a power supply, to keep its voltage within the acceptable range for the micro.

There are two calibrations to make, both fairly easy. 

One is what the leakage current of the capacitor is, record the voltage over time with no load on it. You might want to buffer your meter with a low bias op amp like TL081.  The leakage may change over time, but with a high quality capacitor, especially if reformed at a voltage well above 3v (obviously within the rated voltage of the capacitor) it should be adequately small and stable.

The second is the actual value of the capacitance, electrolytics are notorious for wide tolerances like -20/+80%. Having established the leakage current, add a further load of a resistor, and plot the rate of voltage fall. The resistor and voltage will give you a current, over time will give you a charge, and charge per change of voltage gives you the capacitance.