napa-baselibs / monl / plugins / byte_measure.cpp @ 5f3adef4
History | View | Annotate | Download (2.03 KB)
1 |
/***************************************************************************
|
---|---|
2 |
* Copyright (C) 2009 by Robert Birke
|
3 |
* robert.birke@polito.it
|
4 |
*
|
5 |
* This library is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU Lesser General Public
|
7 |
* License as published by the Free Software Foundation; either
|
8 |
* version 2.1 of the License, or (at your option) any later version.
|
9 |
|
10 |
* This library is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13 |
* Lesser General Public License for more details.
|
14 |
|
15 |
* You should have received a copy of the GNU Lesser General Public
|
16 |
* License along with this library; if not, write to the Free Software
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18 |
***********************************************************************/
|
19 |
|
20 |
#include "byte_measure.h" |
21 |
|
22 |
ByteMeasure::ByteMeasure(class MeasurePlugin *m, MeasurementCapabilities mc, class MeasureDispatcher *md): MonMeasure(m,mc,md) { |
23 |
}; |
24 |
|
25 |
ByteMeasure::~ByteMeasure() { |
26 |
} |
27 |
|
28 |
result ByteMeasure::RxPkt(result *r,ExecutionList *el) { |
29 |
char dbg[512]; |
30 |
snprintf(dbg, sizeof(dbg), "Ts: %f S: %f", r[R_RECEIVE_TIME], r[R_SIZE]); |
31 |
debugOutput(dbg); |
32 |
return r[R_SIZE];
|
33 |
} |
34 |
|
35 |
result ByteMeasure::RxData(result *r, ExecutionList *el) { |
36 |
return RxPkt(r,el);
|
37 |
} |
38 |
|
39 |
result ByteMeasure::TxPkt(result *r,ExecutionList *el) { |
40 |
char dbg[512]; |
41 |
snprintf(dbg, sizeof(dbg), "Ts: %f S: %f", r[R_SEND_TIME], r[R_SIZE]); |
42 |
debugOutput(dbg); |
43 |
return r[R_SIZE];
|
44 |
} |
45 |
|
46 |
result ByteMeasure::TxData(result *r, ExecutionList *el) { |
47 |
return TxPkt(r,el);
|
48 |
} |
49 |
|
50 |
|
51 |
RxByteMeasurePlugin::RxByteMeasurePlugin() { |
52 |
/* Initialise properties: MANDATORY! */
|
53 |
name = "Rx Byte";
|
54 |
desc = "Bytes received [bytes]";
|
55 |
id = RX_BYTE; |
56 |
/* end of mandatory properties */
|
57 |
} |
58 |
|
59 |
TxByteMeasurePlugin::TxByteMeasurePlugin() { |
60 |
/* Initialise properties: MANDATORY! */
|
61 |
name = "Tx Byte";
|
62 |
desc = "Bytes transmitted [bytes]";
|
63 |
id = TX_BYTE; |
64 |
/* end of mandatory properties */
|
65 |
} |