It could be that you need to flush the energest before reading it (in any way, you'll get more accurate results that way).
For every device that has an corresponding energest (eg radio in Rx mode, CPU in LPM mode, sensors), a macro is run every time the device and mode is started, and another when stopped. For instance something like this (don't remember the exact syntax though):
// some process
ENERGEST_ON(ENERGEST_TYPE_RADIO_LISTEN);
cc2420_on();
...
...
...
...
cc2420_off();
ENERGEST_OFF(ENERGEST_TYPE_RADIO_LISTEN);
What it does is basically getting a timestamp expressed in rtimer ticks (as set by cpu/something/rtimer-arch.h: RTIMER_ARCH_SECOND, try printf("%u", RTIMER_SECOND) or checking platform/sky/contiki-conf.h if I remember correctly, presently 8192 ticks/s).
If you, between the _ON(...) and _OFF(...) check the energest, it won't give you the correct value as it doesn't update until the _OFF(...). By running energest_flush(), you force an update of every energest type.
The energest value is always incremented and never reset to zero, that's why you must subtract the previous value (there is a function for setting it to an arbitrary value should you prefer to reset it to zero each time).
The duty cycle = (energest time diff for a device)/(total time between measurements).
The average power consumption during this time = DC * (power consumption for that device when on).
The power consumption = (supply voltage) * (current consumption), but it is mostly preferred to use the DC instead as current consumption often depend on supply voltage, and supply voltage drops as batteries deplete. It also makes it easier to compare between different hardwares.
Minor detail but you could replace the PROCESS_WAIT_EVENT() and etimer_expired-check (as you're only waiting for the etimer) with
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
if you'd like. I think even
PROCESS_WAIT_UNTIL(etimer_expired(&et));
will work fine but will same some bytes if space is precious.
Good files to look in: core/sys/{rtimer, energest}.{c,h}.
I hope that cleared some clouds for you, I tried to keep it more generic as I've been getting some emails about this as well that I took this opportunity to answer to here...
Best,
Marcus Lunden