Accurate Software-Related Average Current Drain Measurements in Embedded Systems