added powertrace to IPv6 including an example
This commit is contained in:
parent
d711887a1b
commit
cf61e522a8
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
584
examples/ipv6/rpl-udp/rpl-udp-powertrace.csc
Normal file
584
examples/ipv6/rpl-udp/rpl-udp-powertrace.csc
Normal file
|
@ -0,0 +1,584 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<simconf>
|
||||
<project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/mrm</project>
|
||||
<project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/mspsim</project>
|
||||
<project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/avrora</project>
|
||||
<project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/mobility</project>
|
||||
<simulation>
|
||||
<title>Data collection network using IPv6 and RPL</title>
|
||||
<delaytime>0</delaytime>
|
||||
<randomseed>generated</randomseed>
|
||||
<motedelay_us>5000000</motedelay_us>
|
||||
<radiomedium>
|
||||
se.sics.cooja.radiomediums.UDGM
|
||||
<transmitting_range>50.0</transmitting_range>
|
||||
<interference_range>50.0</interference_range>
|
||||
<success_ratio_tx>1.0</success_ratio_tx>
|
||||
<success_ratio_rx>1.0</success_ratio_rx>
|
||||
</radiomedium>
|
||||
<events>
|
||||
<logoutput>40000</logoutput>
|
||||
</events>
|
||||
<motetype>
|
||||
se.sics.cooja.mspmote.SkyMoteType
|
||||
<identifier>sky1</identifier>
|
||||
<description>Sky Mote Type #sky1</description>
|
||||
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/rpl-udp/udp-server.c</source>
|
||||
<commands EXPORT="discard">make udp-server.sky TARGET=sky WITH_COMPOWER=1</commands>
|
||||
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/rpl-udp/udp-server.sky</firmware>
|
||||
<moteinterface>se.sics.cooja.interfaces.Position</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.RimeAddress</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.IPAddress</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.Mote2MoteRelations</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.MoteAttributes</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspClock</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspMoteID</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyButton</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyFlash</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyCoffeeFilesystem</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyByteRadio</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspSerial</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyLED</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspDebugOutput</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyTemperature</moteinterface>
|
||||
</motetype>
|
||||
<motetype>
|
||||
se.sics.cooja.mspmote.SkyMoteType
|
||||
<identifier>sky2</identifier>
|
||||
<description>Sky Mote Type #sky2</description>
|
||||
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/rpl-udp/udp-client.c</source>
|
||||
<commands EXPORT="discard">make udp-client.sky TARGET=sky WITH_COMPOWER=1</commands>
|
||||
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/rpl-udp/udp-client.sky</firmware>
|
||||
<moteinterface>se.sics.cooja.interfaces.Position</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.RimeAddress</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.IPAddress</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.Mote2MoteRelations</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.MoteAttributes</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspClock</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspMoteID</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyButton</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyFlash</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyCoffeeFilesystem</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyByteRadio</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspSerial</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyLED</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspDebugOutput</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyTemperature</moteinterface>
|
||||
</motetype>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>48.435974731198804</x>
|
||||
<y>-66.16503914182063</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>1</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky1</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>4.049356309774755</x>
|
||||
<y>98.28771308774003</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>2</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>127.9689727848476</x>
|
||||
<y>91.71883780610729</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>3</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>57.897299848739024</x>
|
||||
<y>92.47229665488265</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>4</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>47.34887596588397</x>
|
||||
<y>-30.341495695501195</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>5</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>47.13486576528276</x>
|
||||
<y>32.944481932122315</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>6</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>-11.42091423859419</x>
|
||||
<y>17.879870626121914</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>7</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>118.92746659954325</x>
|
||||
<y>57.05973076244069</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>8</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>53.68872892015448</x>
|
||||
<y>59.887319605093715</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>9</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>16.45706316609417</x>
|
||||
<y>23.9075414163248</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>10</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>-18.9555027263478</x>
|
||||
<y>75.14274313304935</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>11</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>29.265863595275306</x>
|
||||
<y>85.6911670159044</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>12</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>-39.298891643282545</x>
|
||||
<y>-3.9704359883635574</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>13</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>66.93880603404335</x>
|
||||
<y>-42.39683727590697</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>14</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>94.81678343873172</x>
|
||||
<y>26.921376811426246</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>15</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>-43.06618588715935</x>
|
||||
<y>30.68867105530305</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>16</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>-34.02467970185502</x>
|
||||
<y>-24.313824905298304</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>17</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>-28.750467760427494</x>
|
||||
<y>48.01822457713635</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>18</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>124.95513738974614</x>
|
||||
<y>20.140247172447996</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>19</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>15.703604317318808</x>
|
||||
<y>-47.6710492173345</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>20</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>-40.05235049205791</x>
|
||||
<y>92.47229665488265</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>21</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>121.18784314586934</x>
|
||||
<y>-24.313824905298304</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>22</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>88.03565379975346</x>
|
||||
<y>-44.657213822233054</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>23</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>24.745110502623138</x>
|
||||
<y>-1.7100594420374744</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>24</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>94.06332458995635</x>
|
||||
<y>-2.4635182908128352</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>25</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>-4.639784599615941</x>
|
||||
<y>-9.998106778566445</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>26</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>-13.681290784920272</x>
|
||||
<y>-50.684884612435944</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>27</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>103.10483077526068</x>
|
||||
<y>96.99304974753483</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>28</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>8.922474678340558</x>
|
||||
<y>59.320107308766765</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>29</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>58.650758697514384</x>
|
||||
<y>2.8106936506146916</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>30</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>90.59867707439</x>
|
||||
<y>67.97632874312737</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>31</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
</simulation>
|
||||
<plugin>
|
||||
se.sics.cooja.plugins.SimControl
|
||||
<width>259</width>
|
||||
<z>1</z>
|
||||
<height>184</height>
|
||||
<location_x>0</location_x>
|
||||
<location_y>0</location_y>
|
||||
</plugin>
|
||||
<plugin>
|
||||
se.sics.cooja.plugins.Visualizer
|
||||
<plugin_config>
|
||||
<skin>se.sics.cooja.plugins.skins.IDVisualizerSkin</skin>
|
||||
<skin>se.sics.cooja.plugins.skins.UDGMVisualizerSkin</skin>
|
||||
<skin>se.sics.cooja.plugins.skins.AttributeVisualizerSkin</skin>
|
||||
<viewport>2.349818846983307 0.0 0.0 2.349818846983307 150.19773526533348 176.95275613586946</viewport>
|
||||
</plugin_config>
|
||||
<width>520</width>
|
||||
<z>3</z>
|
||||
<height>523</height>
|
||||
<location_x>269</location_x>
|
||||
<location_y>14</location_y>
|
||||
</plugin>
|
||||
<plugin>
|
||||
se.sics.cooja.plugins.LogListener
|
||||
<plugin_config>
|
||||
<filter />
|
||||
</plugin_config>
|
||||
<width>937</width>
|
||||
<z>0</z>
|
||||
<height>213</height>
|
||||
<location_x>21</location_x>
|
||||
<location_y>464</location_y>
|
||||
</plugin>
|
||||
<plugin>
|
||||
se.sics.cooja.plugins.ScriptRunner
|
||||
<plugin_config>
|
||||
<script>TIMEOUT(12000000, log.log("Total PRR " + totalPRR + "\n"));
|
||||
packetsReceived= new Array();
|
||||
packetsSent = new Array();
|
||||
serverID = 1;
|
||||
nodeCount = 31;
|
||||
totalPRR = 0;
|
||||
|
||||
for(i = 0; i <= nodeCount; i++) {
|
||||
packetsReceived[i] = 0;
|
||||
packetsSent[i] = 0;
|
||||
}
|
||||
|
||||
while(1) {
|
||||
YIELD();
|
||||
|
||||
msgArray = msg.split(' ');
|
||||
if(msgArray[0].equals("DATA")) {
|
||||
if(msgArray.length == 9) {
|
||||
// Received packet
|
||||
senderID = parseInt(msgArray[8]);
|
||||
packetsReceived[senderID]++;
|
||||
|
||||
log.log("SenderID " + senderID + " PRR " + packetsReceived[senderID] / packetsSent[senderID] + "\n");
|
||||
totalReceived = totalSent = 0;
|
||||
for(i = serverID + 1; i <= nodeCount; i++) {
|
||||
totalReceived += packetsReceived[i];
|
||||
totalSent += packetsSent[i];
|
||||
}
|
||||
totalPRR = totalReceived / totalSent;
|
||||
log.log("Total PRR " + totalPRR + " recv " + totalReceived + " sent " + totalSent + "\n");
|
||||
} else if(msgArray.length == 6) {
|
||||
// Sent packet
|
||||
packetsSent[id]++;
|
||||
}
|
||||
}
|
||||
}</script>
|
||||
<active>true</active>
|
||||
</plugin_config>
|
||||
<width>600</width>
|
||||
<z>2</z>
|
||||
<height>700</height>
|
||||
<location_x>665</location_x>
|
||||
<location_y>6</location_y>
|
||||
</plugin>
|
||||
</simconf>
|
||||
|
|
@ -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
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue