2010-02-20 14:15:45 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2010, Swedish Institute of Computer Science.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. Neither the name of the Institute nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* This file is part of the Contiki operating system.
|
|
|
|
*
|
2010-10-06 18:40:21 +00:00
|
|
|
* $Id: powertrace.c,v 1.8 2010/10/06 18:40:21 adamdunkels Exp $
|
2010-02-20 14:15:45 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \file
|
|
|
|
* Powertrace: periodically print out power consumption
|
|
|
|
* \author
|
|
|
|
* Adam Dunkels <adam@sics.se>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "contiki.h"
|
2010-09-22 22:09:52 +00:00
|
|
|
#include "contiki-lib.h"
|
2010-02-20 14:15:45 +00:00
|
|
|
#include "sys/compower.h"
|
2010-02-23 18:22:16 +00:00
|
|
|
#include "powertrace.h"
|
|
|
|
#include "net/rime.h"
|
2010-02-20 14:15:45 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
2010-09-22 22:09:52 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
struct powertrace_sniff_stats {
|
|
|
|
struct powertrace_sniff_stats *next;
|
|
|
|
uint32_t num_input, num_output;
|
|
|
|
uint32_t input_txtime, input_rxtime;
|
|
|
|
uint32_t output_txtime, output_rxtime;
|
2011-10-13 13:09:40 +00:00
|
|
|
#if UIP_CONF_IPV6
|
|
|
|
uint16_t proto; /* includes proto + possibly flags */
|
|
|
|
#endif
|
2010-09-22 22:09:52 +00:00
|
|
|
uint16_t channel;
|
2010-10-06 18:40:21 +00:00
|
|
|
uint32_t last_input_txtime, last_input_rxtime;
|
|
|
|
uint32_t last_output_txtime, last_output_rxtime;
|
2010-09-22 22:09:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define INPUT 1
|
|
|
|
#define OUTPUT 0
|
|
|
|
|
|
|
|
#define MAX_NUM_STATS 16
|
|
|
|
|
|
|
|
MEMB(stats_memb, struct powertrace_sniff_stats, MAX_NUM_STATS);
|
|
|
|
LIST(stats_list);
|
2010-02-20 14:15:45 +00:00
|
|
|
|
|
|
|
PROCESS(powertrace_process, "Periodic power output");
|
|
|
|
/*---------------------------------------------------------------------------*/
|
2010-03-29 21:49:07 +00:00
|
|
|
void
|
|
|
|
powertrace_print(char *str)
|
2010-02-20 14:15:45 +00:00
|
|
|
{
|
|
|
|
static uint32_t last_cpu, last_lpm, last_transmit, last_listen;
|
|
|
|
static uint32_t last_idle_transmit, last_idle_listen;
|
|
|
|
|
2010-10-06 18:40:21 +00:00
|
|
|
uint32_t cpu, lpm, transmit, listen;
|
|
|
|
uint32_t all_cpu, all_lpm, all_transmit, all_listen;
|
|
|
|
uint32_t idle_transmit, idle_listen;
|
|
|
|
uint32_t all_idle_transmit, all_idle_listen;
|
2010-02-20 14:15:45 +00:00
|
|
|
|
|
|
|
static uint32_t seqno;
|
2010-09-22 22:09:52 +00:00
|
|
|
|
2010-10-06 18:40:21 +00:00
|
|
|
uint32_t time, all_time, radio, all_radio;
|
|
|
|
|
2010-09-22 22:09:52 +00:00
|
|
|
struct powertrace_sniff_stats *s;
|
2010-02-20 14:15:45 +00:00
|
|
|
|
|
|
|
energest_flush();
|
2010-09-22 22:09:52 +00:00
|
|
|
|
2010-10-06 18:40:21 +00:00
|
|
|
all_cpu = energest_type_time(ENERGEST_TYPE_CPU);
|
|
|
|
all_lpm = energest_type_time(ENERGEST_TYPE_LPM);
|
|
|
|
all_transmit = energest_type_time(ENERGEST_TYPE_TRANSMIT);
|
|
|
|
all_listen = energest_type_time(ENERGEST_TYPE_LISTEN);
|
2011-05-08 20:25:20 +00:00
|
|
|
all_idle_transmit = compower_idle_activity.transmit;
|
|
|
|
all_idle_listen = compower_idle_activity.listen;
|
2010-10-06 18:40:21 +00:00
|
|
|
|
|
|
|
cpu = all_cpu - last_cpu;
|
|
|
|
lpm = all_lpm - last_lpm;
|
|
|
|
transmit = all_transmit - last_transmit;
|
|
|
|
listen = all_listen - last_listen;
|
2010-02-20 14:15:45 +00:00
|
|
|
idle_transmit = compower_idle_activity.transmit - last_idle_transmit;
|
|
|
|
idle_listen = compower_idle_activity.listen - last_idle_listen;
|
|
|
|
|
|
|
|
last_cpu = energest_type_time(ENERGEST_TYPE_CPU);
|
|
|
|
last_lpm = energest_type_time(ENERGEST_TYPE_LPM);
|
|
|
|
last_transmit = energest_type_time(ENERGEST_TYPE_TRANSMIT);
|
|
|
|
last_listen = energest_type_time(ENERGEST_TYPE_LISTEN);
|
|
|
|
last_idle_listen = compower_idle_activity.listen;
|
|
|
|
last_idle_transmit = compower_idle_activity.transmit;
|
|
|
|
|
2010-10-06 18:40:21 +00:00
|
|
|
radio = transmit + listen;
|
2010-02-20 14:15:45 +00:00
|
|
|
time = cpu + lpm;
|
2010-10-06 18:40:21 +00:00
|
|
|
all_time = all_cpu + all_lpm;
|
|
|
|
all_radio = energest_type_time(ENERGEST_TYPE_LISTEN) +
|
2010-09-22 22:09:52 +00:00
|
|
|
energest_type_time(ENERGEST_TYPE_TRANSMIT);
|
|
|
|
|
2010-10-06 18:40:21 +00:00
|
|
|
printf("%s %lu P %d.%d %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu (radio %d.%02d%% / %d.%02d%% tx %d.%02d%% / %d.%02d%% listen %d.%02d%% / %d.%02d%%)\n",
|
2010-03-29 21:49:07 +00:00
|
|
|
str,
|
2010-09-22 22:09:52 +00:00
|
|
|
clock_time(), rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], seqno,
|
2010-10-06 18:40:21 +00:00
|
|
|
all_cpu, all_lpm, all_transmit, all_listen, all_idle_transmit, all_idle_listen,
|
2010-02-20 14:15:45 +00:00
|
|
|
cpu, lpm, transmit, listen, idle_transmit, idle_listen,
|
2010-10-06 18:40:21 +00:00
|
|
|
(int)((100L * (all_transmit + all_listen)) / all_time),
|
|
|
|
(int)((10000L * (all_transmit + all_listen) / all_time) - (100L * (all_transmit + all_listen) / all_time) * 100),
|
2010-02-20 14:15:45 +00:00
|
|
|
(int)((100L * (transmit + listen)) / time),
|
2010-02-23 18:22:16 +00:00
|
|
|
(int)((10000L * (transmit + listen) / time) - (100L * (transmit + listen) / time) * 100),
|
2010-10-06 18:40:21 +00:00
|
|
|
(int)((100L * all_transmit) / all_time),
|
|
|
|
(int)((10000L * all_transmit) / all_time - (100L * all_transmit / all_time) * 100),
|
2010-02-23 18:22:16 +00:00
|
|
|
(int)((100L * transmit) / time),
|
|
|
|
(int)((10000L * transmit) / time - (100L * transmit / time) * 100),
|
2010-10-06 18:40:21 +00:00
|
|
|
(int)((100L * all_listen) / all_time),
|
|
|
|
(int)((10000L * all_listen) / all_time - (100L * all_listen / all_time) * 100),
|
2010-02-23 18:22:16 +00:00
|
|
|
(int)((100L * listen) / time),
|
|
|
|
(int)((10000L * listen) / time - (100L * listen / time) * 100));
|
2010-09-22 22:09:52 +00:00
|
|
|
|
|
|
|
for(s = list_head(stats_list); s != NULL; s = list_item_next(s)) {
|
2011-10-13 13:09:40 +00:00
|
|
|
|
|
|
|
#if ! UIP_CONF_IPV6
|
2010-10-06 18:40:21 +00:00
|
|
|
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",
|
2010-09-22 22:09:52 +00:00
|
|
|
str, clock_time(), rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], seqno,
|
|
|
|
s->channel,
|
|
|
|
s->num_input, s->input_txtime, s->input_rxtime,
|
2010-10-06 18:40:21 +00:00
|
|
|
s->input_txtime - s->last_input_txtime,
|
|
|
|
s->input_rxtime - s->last_input_rxtime,
|
2010-09-22 22:09:52 +00:00
|
|
|
s->num_output, s->output_txtime, s->output_rxtime,
|
2010-10-06 18:40:21 +00:00
|
|
|
s->output_txtime - s->last_output_txtime,
|
|
|
|
s->output_rxtime - s->last_output_rxtime,
|
2010-09-22 22:09:52 +00:00
|
|
|
s->channel,
|
2010-10-06 18:40:21 +00:00
|
|
|
(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));
|
2011-10-13 13:09:40 +00:00
|
|
|
#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
|
2010-10-06 18:40:21 +00:00
|
|
|
s->last_input_txtime = s->input_txtime;
|
|
|
|
s->last_input_rxtime = s->input_rxtime;
|
|
|
|
s->last_output_txtime = s->output_txtime;
|
|
|
|
s->last_output_rxtime = s->output_rxtime;
|
|
|
|
|
2010-09-22 22:09:52 +00:00
|
|
|
}
|
|
|
|
seqno++;
|
2010-02-20 14:15:45 +00:00
|
|
|
}
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
PROCESS_THREAD(powertrace_process, ev, data)
|
|
|
|
{
|
|
|
|
static struct etimer periodic;
|
|
|
|
clock_time_t *period;
|
|
|
|
PROCESS_BEGIN();
|
|
|
|
|
|
|
|
period = data;
|
|
|
|
|
|
|
|
if(period == NULL) {
|
|
|
|
PROCESS_EXIT();
|
|
|
|
}
|
|
|
|
etimer_set(&periodic, *period);
|
|
|
|
|
|
|
|
while(1) {
|
|
|
|
PROCESS_WAIT_UNTIL(etimer_expired(&periodic));
|
|
|
|
etimer_reset(&periodic);
|
2010-03-29 21:49:07 +00:00
|
|
|
powertrace_print("");
|
2010-02-20 14:15:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PROCESS_END();
|
|
|
|
}
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
void
|
|
|
|
powertrace_start(clock_time_t period)
|
|
|
|
{
|
|
|
|
process_start(&powertrace_process, (void *)&period);
|
|
|
|
}
|
|
|
|
/*---------------------------------------------------------------------------*/
|
2010-03-19 13:23:31 +00:00
|
|
|
void
|
|
|
|
powertrace_stop(void)
|
|
|
|
{
|
|
|
|
process_exit(&powertrace_process);
|
|
|
|
}
|
|
|
|
/*---------------------------------------------------------------------------*/
|
2010-02-23 18:22:16 +00:00
|
|
|
static void
|
2010-09-22 22:09:52 +00:00
|
|
|
add_stats(struct powertrace_sniff_stats *s, int input_or_output)
|
|
|
|
{
|
|
|
|
if(input_or_output == INPUT) {
|
|
|
|
s->num_input++;
|
|
|
|
s->input_txtime += packetbuf_attr(PACKETBUF_ATTR_TRANSMIT_TIME);
|
|
|
|
s->input_rxtime += packetbuf_attr(PACKETBUF_ATTR_LISTEN_TIME);
|
|
|
|
} else if(input_or_output == OUTPUT) {
|
|
|
|
s->num_output++;
|
|
|
|
s->output_txtime += packetbuf_attr(PACKETBUF_ATTR_TRANSMIT_TIME);
|
|
|
|
s->output_rxtime += packetbuf_attr(PACKETBUF_ATTR_LISTEN_TIME);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
|
|
|
add_packet_stats(int input_or_output)
|
|
|
|
{
|
|
|
|
struct powertrace_sniff_stats *s;
|
|
|
|
|
|
|
|
/* Go through the list of stats to find one that matches the channel
|
|
|
|
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)) {
|
2011-10-13 13:09:40 +00:00
|
|
|
if(s->channel == packetbuf_attr(PACKETBUF_ATTR_CHANNEL)
|
|
|
|
#if UIP_CONF_IPV6
|
|
|
|
&& s->proto == packetbuf_attr(PACKETBUF_ATTR_NETWORK_ID)
|
|
|
|
#endif
|
|
|
|
) {
|
2010-09-22 22:09:52 +00:00
|
|
|
add_stats(s, input_or_output);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(s == NULL) {
|
|
|
|
s = memb_alloc(&stats_memb);
|
|
|
|
if(s != NULL) {
|
|
|
|
memset(s, 0, sizeof(struct powertrace_sniff_stats));
|
|
|
|
s->channel = packetbuf_attr(PACKETBUF_ATTR_CHANNEL);
|
2011-10-13 13:09:40 +00:00
|
|
|
#if UIP_CONF_IPV6
|
|
|
|
s->proto = packetbuf_attr(PACKETBUF_ATTR_NETWORK_ID);
|
|
|
|
#endif
|
2010-09-22 22:09:52 +00:00
|
|
|
list_add(stats_list, s);
|
|
|
|
add_stats(s, input_or_output);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
2010-02-23 18:22:16 +00:00
|
|
|
input_sniffer(void)
|
|
|
|
{
|
2010-09-22 22:09:52 +00:00
|
|
|
add_packet_stats(INPUT);
|
|
|
|
}
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
2011-05-08 20:25:20 +00:00
|
|
|
output_sniffer(int mac_status)
|
2010-09-22 22:09:52 +00:00
|
|
|
{
|
|
|
|
add_packet_stats(OUTPUT);
|
|
|
|
}
|
|
|
|
/*---------------------------------------------------------------------------*/
|
2011-10-13 13:09:40 +00:00
|
|
|
#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));
|
|
|
|
}
|
|
|
|
/*---------------------------------------------------------------------------*/
|
2010-09-22 22:09:52 +00:00
|
|
|
static void
|
|
|
|
input_printsniffer(void)
|
|
|
|
{
|
|
|
|
static int seqno = 0;
|
2010-02-23 18:22:16 +00:00
|
|
|
sniffprint("I", seqno++);
|
|
|
|
|
|
|
|
if(packetbuf_attr(PACKETBUF_ATTR_CHANNEL) == 0) {
|
|
|
|
int i;
|
|
|
|
uint8_t *dataptr;
|
2010-09-22 22:09:52 +00:00
|
|
|
|
2010-02-23 18:22:16 +00:00
|
|
|
printf("x %d ", packetbuf_totlen());
|
|
|
|
dataptr = packetbuf_hdrptr();
|
|
|
|
printf("%02x ", dataptr[0]);
|
|
|
|
for(i = 1; i < packetbuf_totlen(); ++i) {
|
|
|
|
printf("%02x ", dataptr[i]);
|
|
|
|
}
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
2011-05-10 13:48:34 +00:00
|
|
|
output_printsniffer(int mac_status)
|
2010-02-23 18:22:16 +00:00
|
|
|
{
|
|
|
|
static int seqno = 0;
|
|
|
|
sniffprint("O", seqno++);
|
|
|
|
}
|
|
|
|
/*---------------------------------------------------------------------------*/
|
2010-09-22 22:09:52 +00:00
|
|
|
RIME_SNIFFER(printsniff, input_printsniffer, output_printsniffer);
|
2010-02-23 18:22:16 +00:00
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
void
|
2011-10-13 13:09:40 +00:00
|
|
|
powertrace_printsniff(powertrace_onoff_t onoff)
|
2010-02-23 18:22:16 +00:00
|
|
|
{
|
|
|
|
switch(onoff) {
|
|
|
|
case POWERTRACE_ON:
|
2011-10-13 13:09:40 +00:00
|
|
|
rime_sniffer_add(&printsniff);
|
2010-09-22 22:09:52 +00:00
|
|
|
break;
|
|
|
|
case POWERTRACE_OFF:
|
2011-10-13 13:09:40 +00:00
|
|
|
rime_sniffer_remove(&printsniff);
|
2010-09-22 22:09:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2011-10-13 13:09:40 +00:00
|
|
|
#endif
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
RIME_SNIFFER(powersniff, input_sniffer, output_sniffer);
|
2010-09-22 22:09:52 +00:00
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
void
|
2011-10-13 13:09:40 +00:00
|
|
|
powertrace_sniff(powertrace_onoff_t onoff)
|
2010-09-22 22:09:52 +00:00
|
|
|
{
|
|
|
|
switch(onoff) {
|
|
|
|
case POWERTRACE_ON:
|
2011-10-13 13:09:40 +00:00
|
|
|
rime_sniffer_add(&powersniff);
|
2010-02-23 18:22:16 +00:00
|
|
|
break;
|
|
|
|
case POWERTRACE_OFF:
|
2011-10-13 13:09:40 +00:00
|
|
|
rime_sniffer_remove(&powersniff);
|
2010-02-23 18:22:16 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|