Replace reads of rimestats with RIMESTATS_GET(x)

This commit is contained in:
George Oikonomou 2013-03-20 21:08:47 +00:00
parent 8c0cf50dca
commit db078cf7e8
8 changed files with 45 additions and 43 deletions

View file

@ -860,7 +860,7 @@ generate_stats(void *arg)
#include "net/rime/rimestats.h" #include "net/rime/rimestats.h"
static const char httpd_cgi_sensor21[] HTTPD_STRING_ATTR = "<em>Packets (RIMESTATS):</em> Tx=%5lu Rx=%5lu TxL=%4lu RxL=%4lu\n"; static const char httpd_cgi_sensor21[] HTTPD_STRING_ATTR = "<em>Packets (RIMESTATS):</em> Tx=%5lu Rx=%5lu TxL=%4lu RxL=%4lu\n";
numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor21, numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor21,
rimestats.tx,rimestats.rx,rimestats.lltx-rimestats.tx,rimestats.llrx-rimestats.rx); RIMESTATS_GET(tx),RIMESTATS_GET(rx),RIMESTATS_GET(lltx)-RIMESTATS_GET(tx),RIMESTATS_GET(llrx)-RIMESTATS_GET(rx));
#endif #endif
#if RADIOSTATS #if RADIOSTATS
@ -1300,7 +1300,7 @@ static uint16_t c0=0x3ff,c1=0x3ff,c2=0x3ff,c3=0x3ff,c4=0x3ff,c5=0x3ff,c6=0x3ff,c
#include "net/rime/rimestats.h" #include "net/rime/rimestats.h"
static const char httpd_cgi_ajaxr1[] HTTPD_STRING_ATTR ="rime(%lu,%lu,%lu,%lu);"; static const char httpd_cgi_ajaxr1[] HTTPD_STRING_ATTR ="rime(%lu,%lu,%lu,%lu);";
numprinted += httpd_snprintf(buf+numprinted, sizeof(buf)-numprinted,httpd_cgi_ajaxr1, numprinted += httpd_snprintf(buf+numprinted, sizeof(buf)-numprinted,httpd_cgi_ajaxr1,
rimestats.tx,rimestats.rx,rimestats.lltx-rimestats.tx,rimestats.llrx-rimestats.rx); RIMESTATS_GET(tx),RIMESTATS_GET(rx),RIMESTATS_GET(lltx)-RIMESTATS_GET(tx),RIMESTATS_GET(llrx)-RIMESTATS_GET(rx));
#endif #endif
#if ENERGEST_CONF_ON #if ENERGEST_CONF_ON

View file

@ -59,14 +59,14 @@ print_stats(void)
PRINTA("S %d.%d clock %lu tx %lu rx %lu rtx %lu rrx %lu rexmit %lu acktx %lu noacktx %lu ackrx %lu timedout %lu badackrx %lu toolong %lu tooshort %lu badsynch %lu badcrc %lu contentiondrop %lu sendingdrop %lu lltx %lu llrx %lu\n", PRINTA("S %d.%d clock %lu tx %lu rx %lu rtx %lu rrx %lu rexmit %lu acktx %lu noacktx %lu ackrx %lu timedout %lu badackrx %lu toolong %lu tooshort %lu badsynch %lu badcrc %lu contentiondrop %lu sendingdrop %lu lltx %lu llrx %lu\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
clock_seconds(), clock_seconds(),
rimestats.tx, rimestats.rx, RIMESTATS_GET(tx), RIMESTATS_GET(rx),
rimestats.reliabletx, rimestats.reliablerx, RIMESTATS_GET(reliabletx), RIMESTATS_GET(reliablerx),
rimestats.rexmit, rimestats.acktx, rimestats.noacktx, RIMESTATS_GET(rexmit), RIMESTATS_GET(acktx), RIMESTATS_GET(noacktx),
rimestats.ackrx, rimestats.timedout, rimestats.badackrx, RIMESTATS_GET(ackrx), RIMESTATS_GET(timedout), RIMESTATS_GET(badackrx),
rimestats.toolong, rimestats.tooshort, RIMESTATS_GET(toolong), RIMESTATS_GET(tooshort),
rimestats.badsynch, rimestats.badcrc, RIMESTATS_GET(badsynch), RIMESTATS_GET(badcrc),
rimestats.contentiondrop, rimestats.sendingdrop, RIMESTATS_GET(contentiondrop), RIMESTATS_GET(sendingdrop),
rimestats.lltx, rimestats.llrx); RIMESTATS_GET(lltx), RIMESTATS_GET(llrx));
#endif /* RIMESTATS_CONF_ENABLED */ #endif /* RIMESTATS_CONF_ENABLED */
#if ENERGEST_CONF_ON #if ENERGEST_CONF_ON
PRINTA("E %d.%d clock %lu cpu %lu lpm %lu irq %lu gled %lu yled %lu rled %lu tx %lu listen %lu sensors %lu serial %lu\n", PRINTA("E %d.%d clock %lu cpu %lu lpm %lu irq %lu gled %lu yled %lu rled %lu tx %lu listen %lu sensors %lu serial %lu\n",

View file

@ -44,5 +44,6 @@
#define BUTTON_SENSOR_CONF_ON 1 #define BUTTON_SENSOR_CONF_ON 1
#define UIP_CONF_ICMP6 1 #define UIP_CONF_ICMP6 1
#define RIMESTATS_CONF_ENABLED 1
#endif /* PROJECT_CONF_H_ */ #endif /* PROJECT_CONF_H_ */

View file

@ -92,10 +92,10 @@ static void
print_stats() print_stats()
{ {
PRINTF("tl=%lu, ts=%lu, bs=%lu, bc=%lu\n", PRINTF("tl=%lu, ts=%lu, bs=%lu, bc=%lu\n",
rimestats.toolong, rimestats.tooshort, rimestats.badsynch, RIMESTATS_GET(toolong), RIMESTATS_GET(tooshort),
rimestats.badcrc); RIMESTATS_GET(badsynch), RIMESTATS_GET(badcrc));
PRINTF("llrx=%lu, lltx=%lu, rx=%lu, tx=%lu\n", rimestats.llrx, PRINTF("llrx=%lu, lltx=%lu, rx=%lu, tx=%lu\n", RIMESTATS_GET(llrx),
rimestats.lltx, rimestats.rx, rimestats.tx); RIMESTATS_GET(lltx), RIMESTATS_GET(rx), RIMESTATS_GET(tx));
} }
#endif #endif
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/

View file

@ -36,7 +36,6 @@
* \author * \author
* Adam Dunkels <adam@sics.se> * Adam Dunkels <adam@sics.se>
*/ */
#include "contiki.h" #include "contiki.h"
#include "net/rime.h" #include "net/rime.h"
#include "lib/random.h" #include "lib/random.h"
@ -72,11 +71,12 @@ static void
print_rime_stats() print_rime_stats()
{ {
PRINTF("\nNetwork Stats\n"); PRINTF("\nNetwork Stats\n");
PRINTF(" TX=%lu , RX=%lu\n", rimestats.tx, rimestats.rx); PRINTF(" TX=%lu , RX=%lu\n", RIMESTATS_GET(tx), RIMESTATS_GET(rx));
PRINTF("LL-TX=%lu , LL-RX=%lu\n", rimestats.lltx, rimestats.llrx); PRINTF("LL-TX=%lu , LL-RX=%lu\n", RIMESTATS_GET(lltx), RIMESTATS_GET(llrx));
PRINTF(" Long=%lu , Short=%lu\n", rimestats.toolong, rimestats.tooshort); PRINTF(" Long=%lu , Short=%lu\n", RIMESTATS_GET(toolong),
PRINTF("T/Out=%lu , CCA-Err=%lu\n", rimestats.timedout, RIMESTATS_GET(tooshort));
rimestats.contentiondrop); PRINTF("T/Out=%lu , CCA-Err=%lu\n", RIMESTATS_GET(timedout),
RIMESTATS_GET(contentiondrop));
} }
static const struct broadcast_callbacks bc_rx = { broadcast_recv }; static const struct broadcast_callbacks bc_rx = { broadcast_recv };

View file

@ -45,5 +45,6 @@
#define PROJECT_CONF_H_ #define PROJECT_CONF_H_
#define BUTTON_SENSOR_CONF_ON 1 #define BUTTON_SENSOR_CONF_ON 1
#define RIMESTATS_CONF_ENABLED 1
#endif /* PROJECT_CONF_H_ */ #endif /* PROJECT_CONF_H_ */

View file

@ -104,10 +104,10 @@ static void
print_stats() print_stats()
{ {
PRINTF("tl=%lu, ts=%lu, bs=%lu, bc=%lu\n", PRINTF("tl=%lu, ts=%lu, bs=%lu, bc=%lu\n",
rimestats.toolong, rimestats.tooshort, rimestats.badsynch, RIMESTATS_GET(toolong), RIMESTATS_GET(tooshort),
rimestats.badcrc); RIMESTATS_GET(badsynch), RIMESTATS_GET(badcrc));
PRINTF("llrx=%lu, lltx=%lu, rx=%lu, tx=%lu\n", rimestats.llrx, PRINTF("llrx=%lu, lltx=%lu, rx=%lu, tx=%lu\n", RIMESTATS_GET(llrx),
rimestats.lltx, rimestats.rx, rimestats.tx); RIMESTATS_GET(lltx), RIMESTATS_GET(rx), RIMESTATS_GET(tx));
} }
#else #else
#define print_stats() #define print_stats()

View file

@ -246,24 +246,24 @@ PROCESS_THREAD(test_collect_process, ev, data)
msg->best_neighbor_rtmetric = n->rtmetric; msg->best_neighbor_rtmetric = n->rtmetric;
} }
msg->tx = rimestats.tx; msg->tx = RIMESTATS_GET(tx);
msg->rx = rimestats.rx; msg->rx = RIMESTATS_GET(rx);
msg->reliabletx = rimestats.reliabletx; msg->reliabletx = RIMESTATS_GET(reliabletx);
msg->reliablerx = rimestats.reliablerx; msg->reliablerx = RIMESTATS_GET(reliablerx);
msg->rexmit = rimestats.rexmit; msg->rexmit = RIMESTATS_GET(rexmit);
msg->acktx = rimestats.acktx; msg->acktx = RIMESTATS_GET(acktx);
msg->noacktx = rimestats.noacktx; msg->noacktx = RIMESTATS_GET(noacktx);
msg->ackrx = rimestats.ackrx; msg->ackrx = RIMESTATS_GET(ackrx);
msg->timedout = rimestats.timedout; msg->timedout = RIMESTATS_GET(timedout);
msg->badackrx = rimestats.badackrx; msg->badackrx = RIMESTATS_GET(badackrx);
msg->toolong = rimestats.toolong; msg->toolong = RIMESTATS_GET(toolong);
msg->tooshort = rimestats.tooshort; msg->tooshort = RIMESTATS_GET(tooshort);
msg->badsynch = rimestats.badsynch; msg->badsynch = RIMESTATS_GET(badsynch);
msg->badcrc = rimestats.badcrc; msg->badcrc = RIMESTATS_GET(badcrc);
msg->contentiondrop = rimestats.contentiondrop; msg->contentiondrop = RIMESTATS_GET(contentiondrop);
msg->sendingdrop = rimestats.sendingdrop; msg->sendingdrop = RIMESTATS_GET(sendingdrop);
msg->lltx = rimestats.lltx; msg->lltx = RIMESTATS_GET(lltx);
msg->llrx = rimestats.llrx; msg->llrx = RIMESTATS_GET(llrx);
#if TIMESYNCH_CONF_ENABLED #if TIMESYNCH_CONF_ENABLED
msg->timestamp = timesynch_time(); msg->timestamp = timesynch_time();
#else #else