2 * Copyright (c) 2011, Olivier MATZ <zer0@droids-corp.org>
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the University of California, Berkeley nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #include <sys/queue.h>
34 #include "xbee_neighbor.h"
35 #include "xbee_stats.h"
36 #include "xbee_proto.h"
40 struct xbee_stats *xbee_get_stats(struct xbee_dev *dev)
45 void xbee_reset_stats(struct xbee_dev *dev)
47 memset(&dev->stats, 0, sizeof(dev->stats));
50 void xbee_dump_stats(FILE *file, struct xbee_dev *dev)
52 fprintf(file, "statistics on dev %s:\n", dev->name);
53 fprintf(file, " rx_frame: %d\n", dev->stats.rx_frame);
54 fprintf(file, " rx_atresp: %d\n", dev->stats.rx_atresp);
55 fprintf(file, " rx_atresp_error: %d\n", dev->stats.rx_atresp_error);
56 fprintf(file, " rx_modem_status: %d\n", dev->stats.rx_modem_status);
57 fprintf(file, " rx_xmit_status: %d\n", dev->stats.rx_xmit_status);
58 fprintf(file, " rx_xmit_status_error: %d\n", dev->stats.rx_xmit_status_error);
59 fprintf(file, " rx_data: %d\n", dev->stats.rx_data);
60 fprintf(file, " rx_expl_data: %d\n", dev->stats.rx_expl_data);
61 fprintf(file, " rx_node_id: %d\n", dev->stats.rx_node_id);
62 fprintf(file, " rx_rmt_atresp: %d\n", dev->stats.rx_rmt_atresp);
63 fprintf(file, " rx_rmt_atresp_error: %d\n", dev->stats.rx_rmt_atresp_error);
64 fprintf(file, " rx_frame_too_small: %d\n", dev->stats.rx_frame_too_small);
65 fprintf(file, " rx_frame_too_large: %d\n", dev->stats.rx_frame_too_large);
66 fprintf(file, " rx_invalid_cksum: %d\n", dev->stats.rx_invalid_cksum);
67 fprintf(file, " rx_invalid_type: %d\n", dev->stats.rx_invalid_type);
68 fprintf(file, " rx_no_delim: %d\n", dev->stats.rx_no_delim);
69 fprintf(file, " tx_frame: %d\n", dev->stats.tx_frame);
70 fprintf(file, " tx_atcmd: %d\n", dev->stats.tx_atcmd);
71 fprintf(file, " tx_atcmd_q: %d\n", dev->stats.tx_atcmd_q);
72 fprintf(file, " tx_data: %d\n", dev->stats.tx_data);
73 fprintf(file, " tx_expl_data: %d\n", dev->stats.tx_expl_data);
74 fprintf(file, " tx_xmit_retries: %d\n", dev->stats.tx_xmit_retries);
75 fprintf(file, " tx_rmt_atcmd: %d\n", dev->stats.tx_rmt_atcmd);
76 fprintf(file, " tx_invalid_type: %d\n", dev->stats.tx_invalid_type);
77 fprintf(file, " tx_invalid_channel: %d\n", dev->stats.tx_invalid_channel);