diff --git a/apps/powertrace/powertrace.c b/apps/powertrace/powertrace.c
index fcbdffa84..0b50c8a74 100644
--- a/apps/powertrace/powertrace.c
+++ b/apps/powertrace/powertrace.c
@@ -52,6 +52,9 @@ struct powertrace_sniff_stats {
uint32_t num_input, num_output;
uint32_t input_txtime, input_rxtime;
uint32_t output_txtime, output_rxtime;
+#if UIP_CONF_IPV6
+ uint16_t proto; /* includes proto + possibly flags */
+#endif
uint16_t channel;
uint32_t last_input_txtime, last_input_rxtime;
uint32_t last_output_txtime, last_output_rxtime;
@@ -132,6 +135,8 @@ powertrace_print(char *str)
(int)((10000L * listen) / time - (100L * listen / time) * 100));
for(s = list_head(stats_list); s != NULL; s = list_item_next(s)) {
+
+#if ! UIP_CONF_IPV6
printf("%s %lu SP %d.%d %lu %u %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu (channel %d radio %d.%02d%% / %d.%02d%%)\n",
str, clock_time(), rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], seqno,
s->channel,
@@ -154,7 +159,30 @@ powertrace_print(char *str)
(s->last_input_rxtime + s->last_input_txtime +
s->last_output_rxtime + s->last_output_txtime))) /
radio));
-
+#else
+ printf("%s %lu SP %d.%d %lu %u %u %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu (proto %u(%u) radio %d.%02d%% / %d.%02d%%)\n",
+ str, clock_time(), rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], seqno,
+ s->proto, s->channel,
+ s->num_input, s->input_txtime, s->input_rxtime,
+ s->input_txtime - s->last_input_txtime,
+ s->input_rxtime - s->last_input_rxtime,
+ s->num_output, s->output_txtime, s->output_rxtime,
+ s->output_txtime - s->last_output_txtime,
+ s->output_rxtime - s->last_output_rxtime,
+ s->proto, s->channel,
+ (int)((100L * (s->input_rxtime + s->input_txtime + s->output_rxtime + s->output_txtime)) / all_radio),
+ (int)((10000L * (s->input_rxtime + s->input_txtime + s->output_rxtime + s->output_txtime)) / all_radio),
+ (int)((100L * (s->input_rxtime + s->input_txtime +
+ s->output_rxtime + s->output_txtime -
+ (s->last_input_rxtime + s->last_input_txtime +
+ s->last_output_rxtime + s->last_output_txtime))) /
+ radio),
+ (int)((10000L * (s->input_rxtime + s->input_txtime +
+ s->output_rxtime + s->output_txtime -
+ (s->last_input_rxtime + s->last_input_txtime +
+ s->last_output_rxtime + s->last_output_txtime))) /
+ radio));
+#endif
s->last_input_txtime = s->input_txtime;
s->last_input_rxtime = s->input_rxtime;
s->last_output_txtime = s->output_txtime;
@@ -198,29 +226,6 @@ powertrace_stop(void)
process_exit(&powertrace_process);
}
/*---------------------------------------------------------------------------*/
-#if ! UIP_CONF_IPV6
-static void
-sniffprint(char *prefix, int seqno)
-{
- const rimeaddr_t *sender, *receiver, *esender, *ereceiver;
-
- sender = packetbuf_addr(PACKETBUF_ADDR_SENDER);
- receiver = packetbuf_addr(PACKETBUF_ADDR_RECEIVER);
- esender = packetbuf_addr(PACKETBUF_ADDR_ESENDER);
- ereceiver = packetbuf_addr(PACKETBUF_ADDR_ERECEIVER);
-
-
- printf("%lu %s %d %u %d %d %d.%d %u %u\n",
- clock_time(),
- prefix,
- rimeaddr_node_addr.u8[0], seqno,
- packetbuf_attr(PACKETBUF_ATTR_CHANNEL),
- packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE),
- esender->u8[0], esender->u8[1],
- packetbuf_attr(PACKETBUF_ATTR_TRANSMIT_TIME),
- packetbuf_attr(PACKETBUF_ATTR_LISTEN_TIME));
-}
-/*---------------------------------------------------------------------------*/
static void
add_stats(struct powertrace_sniff_stats *s, int input_or_output)
{
@@ -244,7 +249,11 @@ add_packet_stats(int input_or_output)
of the packet. If we don't find one, we allocate a new one and
put it on the list. */
for(s = list_head(stats_list); s != NULL; s = list_item_next(s)) {
- if(s->channel == packetbuf_attr(PACKETBUF_ATTR_CHANNEL)) {
+ if(s->channel == packetbuf_attr(PACKETBUF_ATTR_CHANNEL)
+#if UIP_CONF_IPV6
+ && s->proto == packetbuf_attr(PACKETBUF_ATTR_NETWORK_ID)
+#endif
+ ) {
add_stats(s, input_or_output);
break;
}
@@ -254,6 +263,9 @@ add_packet_stats(int input_or_output)
if(s != NULL) {
memset(s, 0, sizeof(struct powertrace_sniff_stats));
s->channel = packetbuf_attr(PACKETBUF_ATTR_CHANNEL);
+#if UIP_CONF_IPV6
+ s->proto = packetbuf_attr(PACKETBUF_ATTR_NETWORK_ID);
+#endif
list_add(stats_list, s);
add_stats(s, input_or_output);
}
@@ -272,6 +284,29 @@ output_sniffer(int mac_status)
add_packet_stats(OUTPUT);
}
/*---------------------------------------------------------------------------*/
+#if ! UIP_CONF_IPV6
+static void
+sniffprint(char *prefix, int seqno)
+{
+ const rimeaddr_t *sender, *receiver, *esender, *ereceiver;
+
+ sender = packetbuf_addr(PACKETBUF_ADDR_SENDER);
+ receiver = packetbuf_addr(PACKETBUF_ADDR_RECEIVER);
+ esender = packetbuf_addr(PACKETBUF_ADDR_ESENDER);
+ ereceiver = packetbuf_addr(PACKETBUF_ADDR_ERECEIVER);
+
+
+ printf("%lu %s %d %u %d %d %d.%d %u %u\n",
+ clock_time(),
+ prefix,
+ rimeaddr_node_addr.u8[0], seqno,
+ packetbuf_attr(PACKETBUF_ATTR_CHANNEL),
+ packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE),
+ esender->u8[0], esender->u8[1],
+ packetbuf_attr(PACKETBUF_ATTR_TRANSMIT_TIME),
+ packetbuf_attr(PACKETBUF_ATTR_LISTEN_TIME));
+}
+/*---------------------------------------------------------------------------*/
static void
input_printsniffer(void)
{
@@ -299,23 +334,9 @@ output_printsniffer(int mac_status)
sniffprint("O", seqno++);
}
/*---------------------------------------------------------------------------*/
-RIME_SNIFFER(powersniff, input_sniffer, output_sniffer);
RIME_SNIFFER(printsniff, input_printsniffer, output_printsniffer);
/*---------------------------------------------------------------------------*/
void
-powertrace_sniff(powertrace_onoff_t onoff)
-{
- switch(onoff) {
- case POWERTRACE_ON:
- rime_sniffer_add(&powersniff);
- break;
- case POWERTRACE_OFF:
- rime_sniffer_remove(&powersniff);
- break;
- }
-}
-/*---------------------------------------------------------------------------*/
-void
powertrace_printsniff(powertrace_onoff_t onoff)
{
switch(onoff) {
@@ -327,10 +348,19 @@ powertrace_printsniff(powertrace_onoff_t onoff)
break;
}
}
+#endif
+/*---------------------------------------------------------------------------*/
+RIME_SNIFFER(powersniff, input_sniffer, output_sniffer);
/*---------------------------------------------------------------------------*/
-#else /* ! UIP_CONF_IPV6 */
void
powertrace_sniff(powertrace_onoff_t onoff)
{
+ switch(onoff) {
+ case POWERTRACE_ON:
+ rime_sniffer_add(&powersniff);
+ break;
+ case POWERTRACE_OFF:
+ rime_sniffer_remove(&powersniff);
+ break;
+ }
}
-#endif /* ! UIP_CONF_IPV6 */
diff --git a/core/net/sicslowpan.c b/core/net/sicslowpan.c
index 9760572f3..820bf2052 100644
--- a/core/net/sicslowpan.c
+++ b/core/net/sicslowpan.c
@@ -159,6 +159,7 @@ void uip_log(char *msg);
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
#define UIP_UDP_BUF ((struct uip_udp_hdr *)&uip_buf[UIP_LLIPH_LEN])
#define UIP_TCP_BUF ((struct uip_tcp_hdr *)&uip_buf[UIP_LLIPH_LEN])
+#define UIP_ICMP_BUF ((struct uip_icmp_hdr *)&uip_buf[UIP_LLIPH_LEN])
/** @} */
@@ -258,6 +259,52 @@ static struct timer reass_timer;
#define sicslowpan_len uip_len
#endif /* SICSLOWPAN_CONF_FRAG */
+/*-------------------------------------------------------------------------*/
+/* Rime Sniffer support for one single listener to enable powertrace of IP */
+/*-------------------------------------------------------------------------*/
+static struct rime_sniffer *callback = NULL;
+
+void
+rime_sniffer_add(struct rime_sniffer *s) {
+ callback = s;
+}
+
+void
+rime_sniffer_remove(struct rime_sniffer *s) {
+ callback = NULL;
+}
+
+static void
+set_packet_attrs() {
+ int c = 0;
+ /* set protocol in NETWORK_ID */
+ packetbuf_set_attr(PACKETBUF_ATTR_NETWORK_ID, UIP_IP_BUF->proto);
+
+ /* assign values to the channel attribute (port or type + code) */
+ if(UIP_IP_BUF->proto == UIP_PROTO_UDP) {
+ c = UIP_UDP_BUF->srcport;
+ if(UIP_UDP_BUF->destport < c) {
+ c = UIP_UDP_BUF->destport;
+ }
+ } else if(UIP_IP_BUF->proto == UIP_PROTO_TCP) {
+ c = UIP_TCP_BUF->srcport;
+ if(UIP_TCP_BUF->destport < c) {
+ c = UIP_TCP_BUF->destport;
+ }
+ } else if(UIP_IP_BUF->proto == UIP_PROTO_ICMP6) {
+ c = UIP_ICMP_BUF->type << 8 | UIP_ICMP_BUF->icode;
+ }
+
+ packetbuf_set_attr(PACKETBUF_ATTR_CHANNEL, c);
+
+/* if(uip_ds6_is_my_addr(&UIP_IP_BUF->srcipaddr)) { */
+/* own = 1; */
+/* } */
+
+}
+
+
+
#if SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_HC06
/** \name HC06 specific variables
* @{
@@ -1301,6 +1348,11 @@ output(uip_lladdr_t *localdest)
/* The MAC address of the destination of the packet */
rimeaddr_t dest;
+ if (callback) {
+ set_packet_attrs();
+ callback->output_callback(0);
+ }
+
/* init */
uncomp_hdr_len = 0;
rime_hdr_len = 0;
@@ -1686,6 +1738,12 @@ input(void)
neighbor_info_packet_received();
#endif /* SICSLOWPAN_CONF_NEIGHBOR_INFO */
+ /* if callback is set then set attributes and call */
+ if (callback) {
+ set_packet_attrs();
+ callback->input_callback();
+ }
+
tcpip_input();
#if SICSLOWPAN_CONF_FRAG
}
diff --git a/examples/ipv6/rpl-udp/Makefile b/examples/ipv6/rpl-udp/Makefile
index 270ccff11..6c7e2cb7a 100644
--- a/examples/ipv6/rpl-udp/Makefile
+++ b/examples/ipv6/rpl-udp/Makefile
@@ -6,6 +6,11 @@ WITH_UIP6=1
UIP_CONF_IPV6=1
CFLAGS+= -DUIP_CONF_IPV6_RPL
+ifdef WITH_COMPOWER
+APPS+=powertrace
+CFLAGS+= -DCONTIKIMAC_CONF_COMPOWER=1 -DWITH_COMPOWER=1 -DQUEUEBUF_CONF_NUM=4
+endif
+
ifdef SERVER_REPLY
CFLAGS+=-DSERVER_REPLY=$(SERVER_REPLY)
endif
diff --git a/examples/ipv6/rpl-udp/rpl-udp-powertrace.csc b/examples/ipv6/rpl-udp/rpl-udp-powertrace.csc
new file mode 100644
index 000000000..853294dad
--- /dev/null
+++ b/examples/ipv6/rpl-udp/rpl-udp-powertrace.csc
@@ -0,0 +1,584 @@
+
+
+ [CONTIKI_DIR]/tools/cooja/apps/mrm
+ [CONTIKI_DIR]/tools/cooja/apps/mspsim
+ [CONTIKI_DIR]/tools/cooja/apps/avrora
+ [CONTIKI_DIR]/tools/cooja/apps/mobility
+
+ Data collection network using IPv6 and RPL
+ 0
+ generated
+ 5000000
+
+ se.sics.cooja.radiomediums.UDGM
+ 50.0
+ 50.0
+ 1.0
+ 1.0
+
+
+ 40000
+
+
+ se.sics.cooja.mspmote.SkyMoteType
+ sky1
+ Sky Mote Type #sky1
+
+ make udp-server.sky TARGET=sky WITH_COMPOWER=1
+ [CONTIKI_DIR]/examples/ipv6/rpl-udp/udp-server.sky
+ se.sics.cooja.interfaces.Position
+ se.sics.cooja.interfaces.RimeAddress
+ se.sics.cooja.interfaces.IPAddress
+ se.sics.cooja.interfaces.Mote2MoteRelations
+ se.sics.cooja.interfaces.MoteAttributes
+ se.sics.cooja.mspmote.interfaces.MspClock
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ se.sics.cooja.mspmote.interfaces.SkyButton
+ se.sics.cooja.mspmote.interfaces.SkyFlash
+ se.sics.cooja.mspmote.interfaces.SkyCoffeeFilesystem
+ se.sics.cooja.mspmote.interfaces.SkyByteRadio
+ se.sics.cooja.mspmote.interfaces.MspSerial
+ se.sics.cooja.mspmote.interfaces.SkyLED
+ se.sics.cooja.mspmote.interfaces.MspDebugOutput
+ se.sics.cooja.mspmote.interfaces.SkyTemperature
+
+
+ se.sics.cooja.mspmote.SkyMoteType
+ sky2
+ Sky Mote Type #sky2
+
+ make udp-client.sky TARGET=sky WITH_COMPOWER=1
+ [CONTIKI_DIR]/examples/ipv6/rpl-udp/udp-client.sky
+ se.sics.cooja.interfaces.Position
+ se.sics.cooja.interfaces.RimeAddress
+ se.sics.cooja.interfaces.IPAddress
+ se.sics.cooja.interfaces.Mote2MoteRelations
+ se.sics.cooja.interfaces.MoteAttributes
+ se.sics.cooja.mspmote.interfaces.MspClock
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ se.sics.cooja.mspmote.interfaces.SkyButton
+ se.sics.cooja.mspmote.interfaces.SkyFlash
+ se.sics.cooja.mspmote.interfaces.SkyCoffeeFilesystem
+ se.sics.cooja.mspmote.interfaces.SkyByteRadio
+ se.sics.cooja.mspmote.interfaces.MspSerial
+ se.sics.cooja.mspmote.interfaces.SkyLED
+ se.sics.cooja.mspmote.interfaces.MspDebugOutput
+ se.sics.cooja.mspmote.interfaces.SkyTemperature
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ 48.435974731198804
+ -66.16503914182063
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 1
+
+ sky1
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ 4.049356309774755
+ 98.28771308774003
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 2
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ 127.9689727848476
+ 91.71883780610729
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 3
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ 57.897299848739024
+ 92.47229665488265
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 4
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ 47.34887596588397
+ -30.341495695501195
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 5
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ 47.13486576528276
+ 32.944481932122315
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 6
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ -11.42091423859419
+ 17.879870626121914
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 7
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ 118.92746659954325
+ 57.05973076244069
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 8
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ 53.68872892015448
+ 59.887319605093715
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 9
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ 16.45706316609417
+ 23.9075414163248
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 10
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ -18.9555027263478
+ 75.14274313304935
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 11
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ 29.265863595275306
+ 85.6911670159044
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 12
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ -39.298891643282545
+ -3.9704359883635574
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 13
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ 66.93880603404335
+ -42.39683727590697
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 14
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ 94.81678343873172
+ 26.921376811426246
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 15
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ -43.06618588715935
+ 30.68867105530305
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 16
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ -34.02467970185502
+ -24.313824905298304
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 17
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ -28.750467760427494
+ 48.01822457713635
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 18
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ 124.95513738974614
+ 20.140247172447996
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 19
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ 15.703604317318808
+ -47.6710492173345
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 20
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ -40.05235049205791
+ 92.47229665488265
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 21
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ 121.18784314586934
+ -24.313824905298304
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 22
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ 88.03565379975346
+ -44.657213822233054
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 23
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ 24.745110502623138
+ -1.7100594420374744
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 24
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ 94.06332458995635
+ -2.4635182908128352
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 25
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ -4.639784599615941
+ -9.998106778566445
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 26
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ -13.681290784920272
+ -50.684884612435944
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 27
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ 103.10483077526068
+ 96.99304974753483
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 28
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ 8.922474678340558
+ 59.320107308766765
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 29
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ 58.650758697514384
+ 2.8106936506146916
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 30
+
+ sky2
+
+
+
+
+ se.sics.cooja.interfaces.Position
+ 90.59867707439
+ 67.97632874312737
+ 0.0
+
+
+ se.sics.cooja.mspmote.interfaces.MspMoteID
+ 31
+
+ sky2
+
+
+
+ se.sics.cooja.plugins.SimControl
+ 259
+ 1
+ 184
+ 0
+ 0
+
+
+ se.sics.cooja.plugins.Visualizer
+
+ se.sics.cooja.plugins.skins.IDVisualizerSkin
+ se.sics.cooja.plugins.skins.UDGMVisualizerSkin
+ se.sics.cooja.plugins.skins.AttributeVisualizerSkin
+ 2.349818846983307 0.0 0.0 2.349818846983307 150.19773526533348 176.95275613586946
+
+ 520
+ 3
+ 523
+ 269
+ 14
+
+
+ se.sics.cooja.plugins.LogListener
+
+
+
+ 937
+ 0
+ 213
+ 21
+ 464
+
+
+ se.sics.cooja.plugins.ScriptRunner
+
+
+ true
+
+ 600
+ 2
+ 700
+ 665
+ 6
+
+
+
diff --git a/examples/ipv6/rpl-udp/udp-client.c b/examples/ipv6/rpl-udp/udp-client.c
index 2490399bb..037408858 100644
--- a/examples/ipv6/rpl-udp/udp-client.c
+++ b/examples/ipv6/rpl-udp/udp-client.c
@@ -34,7 +34,9 @@
#include "net/uip-ds6.h"
#include "net/uip-udp-packet.h"
#include "sys/ctimer.h"
-
+#ifdef WITH_COMPOWER
+#include "powertrace.h"
+#endif
#include
#include
@@ -145,6 +147,7 @@ PROCESS_THREAD(udp_client_process, ev, data)
{
static struct etimer periodic;
static struct ctimer backoff_timer;
+ static int print = 0;
PROCESS_BEGIN();
@@ -165,6 +168,10 @@ PROCESS_THREAD(udp_client_process, ev, data)
PRINTF(" local/remote port %u/%u\n",
UIP_HTONS(client_conn->lport), UIP_HTONS(client_conn->rport));
+#if WITH_COMPOWER
+ powertrace_sniff(POWERTRACE_ON);
+#endif
+
etimer_set(&periodic, SEND_INTERVAL);
while(1) {
PROCESS_YIELD();
@@ -175,6 +182,16 @@ PROCESS_THREAD(udp_client_process, ev, data)
if(etimer_expired(&periodic)) {
etimer_reset(&periodic);
ctimer_set(&backoff_timer, SEND_TIME, send_packet, NULL);
+
+#if WITH_COMPOWER
+ if (print == 0) {
+ powertrace_print("#P");
+ }
+ if (++print == 3) {
+ print = 0;
+ }
+#endif
+
}
}