The compower module accumulates power consumption information and attributes it to communication activities.
Examples of communication activities are packet transmission, packet reception, and idle listening.
Data Structures | |
struct | compower_activity |
An activity record that contains power consumption information for a specific communication activity. More... | |
Files | |
file | compower.c |
Communication power accounting module | |
file | compower.h |
Header file for the communication power accounting module | |
Functions | |
void | compower_accumulate (struct compower_activity *a) |
Accumulate power contumption for a communication activity. More... | |
void | compower_accumulate_attrs (struct compower_activity *a) |
Accumulate power contumption for a communication activity based on energy data in packet attributes. More... | |
void | compower_attrconv (struct compower_activity *a) |
Convert power contumption information to packet attributes. More... | |
void | compower_clear (struct compower_activity *a) |
Clear power consumption information for a communication activity. More... | |
void | compower_init (void) |
Initialize the communication power accounting module. More... | |
Variables | |
struct compower_activity | compower_idle_activity |
The default idle communication activity. More... | |
struct compower_activity | compower_idle_activity |
The default idle communication activity. More... | |
void compower_accumulate | ( | struct compower_activity * | a | ) |
Accumulate power contumption for a communication activity.
a | A pointer to an activity structure. This function accumulates power consumption information for a communication activity. The function typically is called by a power-saving MAC protocol when the radio is switched off, or when a packet is received or transmitted. |
References energest_flush(), ENERGEST_TYPE_LISTEN, energest_type_time(), ENERGEST_TYPE_TRANSMIT, compower_activity::listen, listen(), transmit(), and compower_activity::transmit.
Referenced by input_packet(), powercycle_turn_radio_off(), and send_packet().
void compower_accumulate_attrs | ( | struct compower_activity * | a | ) |
Accumulate power contumption for a communication activity based on energy data in packet attributes.
a | A pointer to an activity structure. This function accumulates power consumption information for a communication activity from packet attributes (see \ref packetbufattr "packet attributes"). |
References compower_activity::listen, packetbuf_attr(), PACKETBUF_ATTR_LISTEN_TIME, PACKETBUF_ATTR_TRANSMIT_TIME, and compower_activity::transmit.
void compower_attrconv | ( | struct compower_activity * | a | ) |
Convert power contumption information to packet attributes.
a | A pointer to an activity structure. This function converts accumulated power consumption information for a communication activity to packet attributes (see \ref packetbufattr "packet attributes"). |
References compower_activity::listen, packetbuf_attr(), PACKETBUF_ATTR_LISTEN_TIME, PACKETBUF_ATTR_TRANSMIT_TIME, packetbuf_set_attr(), and compower_activity::transmit.
Referenced by input_packet(), and send_packet().
void compower_clear | ( | struct compower_activity * | a | ) |
Clear power consumption information for a communication activity.
a | A pointer to an activity structure. This function clears any power contumption information that has previously been accumulated in an activity structure. |
References compower_activity::listen, and compower_activity::transmit.
Referenced by compower_init(), input_packet(), and send_packet().
void compower_init | ( | void | ) |
Initialize the communication power accounting module.
This function initializes the communication power accounting module. The function is called by the system during boot-up.
References compower_clear(), and compower_idle_activity.
struct compower_activity compower_idle_activity |
The default idle communication activity.
This is the idle communication activity, to which all energy that is not possible to attribute to individual packets, is attributed. Examples include idle listening for incoming packets and MAC-level beacon transmissions.
Referenced by compower_init(), powercycle_turn_radio_off(), and PROCESS_THREAD().
struct compower_activity compower_idle_activity |
The default idle communication activity.
This is the idle communication activity, to which all energy that is not possible to attribute to individual packets, is attributed. Examples include idle listening for incoming packets and MAC-level beacon transmissions.
Referenced by compower_init(), powercycle_turn_radio_off(), and PROCESS_THREAD().