Added functions for turning powertracing off
This commit is contained in:
parent
2e8bfa5d9a
commit
aeec1769dc
3 changed files with 14 additions and 5 deletions
|
@ -1 +1,2 @@
|
||||||
powertrace_src = powertrace.c
|
powertrace_src = powertrace.c
|
||||||
|
-include $(CONTIKI)/tools/powertrace/Makefile.powertrace
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: powertrace.c,v 1.2 2010/02/23 18:22:16 adamdunkels Exp $
|
* $Id: powertrace.c,v 1.3 2010/03/19 13:23:31 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,8 +79,8 @@ print_power(void)
|
||||||
|
|
||||||
time = cpu + lpm;
|
time = cpu + lpm;
|
||||||
|
|
||||||
printf("P %d %lu %lu %lu %lu %lu %lu %lu (radio %d.%02d%% tx %d.%02d%% listen %d.%02d%%)\n",
|
printf("%lu P %d %lu %lu %lu %lu %lu %lu %lu (radio %d.%02d%% tx %d.%02d%% listen %d.%02d%%)\n",
|
||||||
node_id, seqno++,
|
clock_time(), node_id, seqno++,
|
||||||
cpu, lpm, transmit, listen, idle_transmit, idle_listen,
|
cpu, lpm, transmit, listen, idle_transmit, idle_listen,
|
||||||
(int)((100L * (transmit + listen)) / time),
|
(int)((100L * (transmit + listen)) / time),
|
||||||
(int)((10000L * (transmit + listen) / time) - (100L * (transmit + listen) / time) * 100),
|
(int)((10000L * (transmit + listen) / time) - (100L * (transmit + listen) / time) * 100),
|
||||||
|
@ -118,6 +118,12 @@ powertrace_start(clock_time_t period)
|
||||||
process_start(&powertrace_process, (void *)&period);
|
process_start(&powertrace_process, (void *)&period);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
powertrace_stop(void)
|
||||||
|
{
|
||||||
|
process_exit(&powertrace_process);
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
sniffprint(char *prefix, int seqno)
|
sniffprint(char *prefix, int seqno)
|
||||||
{
|
{
|
||||||
|
@ -129,7 +135,8 @@ sniffprint(char *prefix, int seqno)
|
||||||
ereceiver = packetbuf_addr(PACKETBUF_ADDR_ERECEIVER);
|
ereceiver = packetbuf_addr(PACKETBUF_ADDR_ERECEIVER);
|
||||||
|
|
||||||
|
|
||||||
printf("%s %d %u %d %d %d.%d %u %u\n",
|
printf("%lu %s %d %u %d %d %d.%d %u %u\n",
|
||||||
|
clock_time(),
|
||||||
prefix,
|
prefix,
|
||||||
node_id, seqno,
|
node_id, seqno,
|
||||||
packetbuf_attr(PACKETBUF_ATTR_CHANNEL),
|
packetbuf_attr(PACKETBUF_ATTR_CHANNEL),
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: powertrace.h,v 1.2 2010/02/23 18:22:16 adamdunkels Exp $
|
* $Id: powertrace.h,v 1.3 2010/03/19 13:23:31 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,6 +44,7 @@
|
||||||
#include "sys/clock.h"
|
#include "sys/clock.h"
|
||||||
|
|
||||||
void powertrace_start(clock_time_t perioc);
|
void powertrace_start(clock_time_t perioc);
|
||||||
|
void powertrace_stop(void);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
POWERTRACE_ON,
|
POWERTRACE_ON,
|
||||||
|
|
Loading…
Add table
Reference in a new issue