added powertrace to IPv6 including an example

This commit is contained in:
Joakim Eriksson 2011-10-13 15:09:40 +02:00
parent d711887a1b
commit cf61e522a8
5 changed files with 736 additions and 42 deletions

View file

@ -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 <stdio.h>
#include <string.h>
@ -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
}
}