From 0c4c88ae66ccac35403709155fdd2d56fd4f2654 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Tue, 23 Feb 2010 18:39:00 +0000 Subject: [PATCH] Improved per-packet power profiling: if a packet is retransmitted, the new energy is added to the old energy so that it is possible to measure the full energy for all transmissions of the packet --- core/sys/compower.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/sys/compower.c b/core/sys/compower.c index e0e4a8f65..c1f8cdc90 100644 --- a/core/sys/compower.c +++ b/core/sys/compower.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: compower.c,v 1.3 2009/03/12 21:58:21 adamdunkels Exp $ + * $Id: compower.c,v 1.4 2010/02/23 18:39:00 adamdunkels Exp $ */ /** @@ -81,8 +81,10 @@ compower_clear(struct compower_activity *e) void compower_attrconv(struct compower_activity *e) { - packetbuf_set_attr(PACKETBUF_ATTR_LISTEN_TIME, e->listen); - packetbuf_set_attr(PACKETBUF_ATTR_TRANSMIT_TIME, e->transmit); + packetbuf_set_attr(PACKETBUF_ATTR_LISTEN_TIME, + packetbuf_attr(PACKETBUF_ATTR_LISTEN_TIME) + e->listen); + packetbuf_set_attr(PACKETBUF_ATTR_TRANSMIT_TIME, + packetbuf_attr(PACKETBUF_ATTR_TRANSMIT_TIME) + e->transmit); } /*---------------------------------------------------------------------------*/ void