Let's assume I have a microcontroller with some amount of peripherals attached and would like to be able to make a reasonable estimate of battery life. Because I might have it sleep at times, and various peripherals would be in differing states, my current consumption might vary between uA (in sleep mode) and some 10s of mA (when awake).
Now, I could attach a battery and let it run down and measure the time, but this makes it both time consuming and hard (and possibly expensive) to compare different approaches, both in the firmware and hardware.
I could place a multimeter in series, but even if it has data logging, that is at some interval and I'd have to interpolate, and could entirely miss variations smaller than the interval. (Plus burden voltage and all that.)
If my device sleeps enough, the awake current becomes somewhat negligible, but that might require a 1000:1 ratio of sleep time to awake time, so that's not likely on all designs.
Is there some device that integrates current over time at very small amounts (e.g., not the Kill-a-watt outlet meter)? Basically I'm interested to know that "over the last hour, 20mAh were consumed". Bonus points if I can get precision current measurements at any given time, to compare awake and asleep current consumption.