Contiki 2.5
statistics.h
Go to the documentation of this file.
1  /**
2  * \defgroup statistics Statistics module
3  *
4  * @{
5  */
6 
7 /**
8  * \file
9  * \brief uDTN Statistics Module header
10  * \author Wolf-Bastian Poettner <poettner@ibr.cs.tu-bs.de>
11  */
12 
13 #ifndef STATISTICS_H
14 #define STATISTICS_H
15 
16 #include "contiki.h"
17 #include "net/rime/rimeaddr.h"
18 
19 #ifdef STATISTICS_CONF_ELEMENTS
20 #define STATISTICS_ELEMENTS STATISTICS_CONF_ELEMENTS
21 #else
22 #define STATISTICS_ELEMENTS 0
23 #endif
24 
25 #ifdef STATISTICS_CONF_PERIOD
26 #define STATISTICS_PERIOD STATISTICS_CONF_PERIOD
27 #else
28 #define STATISTICS_PERIOD 0
29 #endif
30 
31 // 8 bytes per contact
32 #ifdef STATISTICS_CONF_CONTACTS
33 #define STATISTICS_CONTACTS STATISTICS_CONF_CONTACTS
34 #else
35 #define STATISTICS_CONTACTS 0
36 #endif
37 
38 extern process_event_t dtn_statistics_overrun;
39 
40 struct statistics_element_t
41 {
42  uint8_t bundles_incoming;
43  uint8_t bundles_outgoing;
44  uint8_t bundles_generated;
45  uint8_t bundles_delivered;
46 
47  uint8_t storage_bundles;
48  uint8_t contacts_count;
49 
50  uint16_t contacts_duration;
51  uint16_t storage_memory;
52 };
53 
54 struct contact_element_t
55 {
56  uint8_t peer;
57  uint16_t time_difference;
58  uint16_t duration;
59 };
60 
61 uint16_t statistics_setup();
62 uint8_t statistics_get_bundle(uint8_t * buffer, uint8_t maximum_length);
63 uint8_t statistics_get_contacts_bundle(uint8_t * buffer, uint8_t maximum_length);
64 void statistics_reset(void);
66 
67 void statistics_bundle_incoming(uint8_t count);
68 void statistics_bundle_outgoing(uint8_t count);
69 void statistics_bundle_generated(uint8_t count);
70 void statistics_bundle_delivered(uint8_t count);
71 
72 void statistics_storage_bundles(uint8_t bundles);
73 void statistics_storage_memory(uint16_t free);
74 
75 void statistics_contacts_up(rimeaddr_t * peer);
76 void statistics_contacts_down(rimeaddr_t * peer, uint16_t duration);
77 
78 #endif /* STATISTICS_H */
79 
80 /** @} */