gem5  v22.0.0.1
etherdevice.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2004-2005 The Regents of The University of Michigan
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met: 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 copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #include "dev/net/etherdevice.hh"
30 
31 #include "sim/stats.hh"
32 
33 namespace gem5
34 {
35 
37  : statistics::Group(parent, "EtherDevice"),
38  ADD_STAT(postedInterrupts, statistics::units::Count::get(),
39  "Number of posts to CPU"),
40  ADD_STAT(txBytes, statistics::units::Byte::get(),
41  "Bytes Transmitted"),
42  ADD_STAT(rxBytes, statistics::units::Byte::get(), "Bytes Received"),
43  ADD_STAT(txPackets, statistics::units::Count::get(),
44  "Number of Packets Transmitted"),
45  ADD_STAT(rxPackets, statistics::units::Count::get(),
46  "Number of Packets Received"),
47  ADD_STAT(txBandwidth, statistics::units::Rate<
48  statistics::units::Bit, statistics::units::Second>::get(),
49  "Transmit Bandwidth",
50  txBytes * statistics::constant(8) / simSeconds),
51  ADD_STAT(rxBandwidth, statistics::units::Rate<
52  statistics::units::Bit, statistics::units::Second>::get(),
53  "Receive Bandwidth",
54  rxBytes * statistics::constant(8) / simSeconds),
55  ADD_STAT(txIpChecksums, statistics::units::Count::get(),
56  "Number of tx IP Checksums done by device"),
57  ADD_STAT(rxIpChecksums, statistics::units::Count::get(),
58  "Number of rx IP Checksums done by device"),
59  ADD_STAT(txTcpChecksums, statistics::units::Count::get(),
60  "Number of tx TCP Checksums done by device"),
61  ADD_STAT(rxTcpChecksums, statistics::units::Count::get(),
62  "Number of rx TCP Checksums done by device"),
63  ADD_STAT(txUdpChecksums, statistics::units::Count::get(),
64  "Number of tx UDP Checksums done by device"),
65  ADD_STAT(rxUdpChecksums, statistics::units::Count::get(),
66  "Number of rx UDP Checksums done by device"),
67  ADD_STAT(descDmaReads, statistics::units::Count::get(),
68  "Number of descriptors the device read w/ DMA"),
69  ADD_STAT(descDmaWrites, statistics::units::Count::get(),
70  "Number of descriptors the device wrote w/ DMA"),
71  ADD_STAT(descDmaRdBytes, statistics::units::Count::get(),
72  "Number of descriptor bytes read w/ DMA"),
73  ADD_STAT(descDmaWrBytes, statistics::units::Count::get(),
74  "Number of descriptor bytes write w/ DMA"),
75  ADD_STAT(totBandwidth, statistics::units::Rate<
76  statistics::units::Bit, statistics::units::Second>::get(),
77  "Total Bandwidth",
78  txBandwidth + rxBandwidth),
79  ADD_STAT(totPackets, statistics::units::Count::get(), "Total Packets",
80  txPackets + rxPackets),
81  ADD_STAT(totBytes, statistics::units::Byte::get(), "Total Bytes",
82  txBytes + rxBytes),
83  ADD_STAT(totPacketRate, statistics::units::Rate<
84  statistics::units::Count, statistics::units::Second>::get(),
85  "Total Packet Tranmission Rate",
86  totPackets / simSeconds),
87  ADD_STAT(txPacketRate, statistics::units::Rate<
88  statistics::units::Count, statistics::units::Second>::get(),
89  "Packet Tranmission Rate",
90  txPackets / simSeconds),
91  ADD_STAT(rxPacketRate, statistics::units::Rate<
92  statistics::units::Count, statistics::units::Second>::get(),
93  "Packet Reception Rate",
94  rxPackets / simSeconds),
95  ADD_STAT(postedSwi, statistics::units::Count::get(),
96  "Number of software interrupts posted to CPU"),
97  ADD_STAT(totalSwi, statistics::units::Count::get(),
98  "Total number of Swi written to ISR"),
99  ADD_STAT(coalescedSwi, statistics::units::Rate<
100  statistics::units::Count, statistics::units::Count>::get(),
101  "Average number of Swi's coalesced into each post",
102  totalSwi / postedInterrupts),
103  ADD_STAT(postedRxIdle, statistics::units::Count::get(),
104  "Number of rxIdle interrupts posted to CPU"),
105  ADD_STAT(totalRxIdle, statistics::units::Count::get(),
106  "Total number of RxIdle written to ISR"),
107  ADD_STAT(coalescedRxIdle, statistics::units::Rate<
108  statistics::units::Count, statistics::units::Count>::get(),
109  "Average number of RxIdle's coalesced into each post",
110  totalRxIdle / postedInterrupts),
111  ADD_STAT(postedRxOk, statistics::units::Count::get(),
112  "Number of RxOk interrupts posted to CPU"),
113  ADD_STAT(totalRxOk, statistics::units::Count::get(),
114  "Total number of RxOk written to ISR"),
115  ADD_STAT(coalescedRxOk, statistics::units::Rate<
116  statistics::units::Count, statistics::units::Count>::get(),
117  "Average number of RxOk's coalesced into each post",
118  totalRxOk / postedInterrupts),
119  ADD_STAT(postedRxDesc, statistics::units::Count::get(),
120  "Number of RxDesc interrupts posted to CPU"),
121  ADD_STAT(totalRxDesc, statistics::units::Count::get(),
122  "Total number of RxDesc written to ISR"),
123  ADD_STAT(coalescedRxDesc, statistics::units::Rate<
124  statistics::units::Count, statistics::units::Count>::get(),
125  "Average number of RxDesc's coalesced into each post",
126  totalRxDesc / postedInterrupts),
127  ADD_STAT(postedTxOk, statistics::units::Count::get(),
128  "Number of TxOk interrupts posted to CPU"),
129  ADD_STAT(totalTxOk, statistics::units::Count::get(),
130  "Total number of TxOk written to ISR"),
131  ADD_STAT(coalescedTxOk, statistics::units::Rate<
132  statistics::units::Count, statistics::units::Count>::get(),
133  "Average number of TxOk's coalesced into each post",
134  totalTxOk / postedInterrupts),
135  ADD_STAT(postedTxIdle, statistics::units::Count::get(),
136  "Number of TxIdle interrupts posted to CPU"),
137  ADD_STAT(totalTxIdle, statistics::units::Count::get(),
138  "Total number of TxIdle written to ISR"),
139  ADD_STAT(coalescedTxIdle, statistics::units::Rate<
140  statistics::units::Count, statistics::units::Count>::get(),
141  "Average number of TxIdle's coalesced into each post",
142  totalTxIdle / postedInterrupts),
143  ADD_STAT(postedTxDesc, statistics::units::Count::get(),
144  "Number of TxDesc interrupts posted to CPU"),
145  ADD_STAT(totalTxDesc, statistics::units::Count::get(),
146  "Total number of TxDesc written to ISR"),
147  ADD_STAT(coalescedTxDesc, statistics::units::Rate<
148  statistics::units::Count, statistics::units::Count>::get(),
149  "Average number of TxDesc's coalesced into each post",
150  totalTxDesc / postedInterrupts),
151  ADD_STAT(postedRxOrn, statistics::units::Count::get(),
152  "Number of RxOrn posted to CPU"),
153  ADD_STAT(totalRxOrn, statistics::units::Count::get(),
154  "Total number of RxOrn written to ISR"),
155  ADD_STAT(coalescedRxOrn, statistics::units::Rate<
156  statistics::units::Count, statistics::units::Count>::get(),
157  "Average number of RxOrn's coalesced into each post",
158  totalRxOrn / postedInterrupts),
159  ADD_STAT(coalescedTotal, statistics::units::Rate<
160  statistics::units::Count, statistics::units::Count>::get(),
161  "Average number of interrupts coalesced into each post"),
162  ADD_STAT(droppedPackets, statistics::units::Count::get(),
163  "Number of packets dropped")
164 {
165 
167  .precision(0);
168 
169  txBytes
170  .prereq(txBytes);
171 
172  rxBytes
173  .prereq(rxBytes);
174 
175  txPackets
176  .prereq(txBytes);
177 
178  rxPackets
179  .prereq(rxBytes);
180 
182  .precision(0)
183  .prereq(txBytes);
184 
186  .precision(0)
187  .prereq(rxBytes);
188 
190  .precision(0)
191  .prereq(txBytes);
192 
194  .precision(0)
195  .prereq(rxBytes);
196 
198  .precision(0)
199  .prereq(txBytes);
200 
202  .precision(0)
203  .prereq(rxBytes);
204 
206  .precision(0);
207 
209  .precision(0);
210 
212  .precision(0);
213 
215  .precision(0);
216 
218  .precision(0)
219  .prereq(txBytes)
220  ;
221 
223  .precision(0)
224  .prereq(rxBytes);
225 
227  .precision(0)
228  .prereq(totBytes);
229 
230  totPackets
231  .precision(0)
232  .prereq(totBytes);
233 
234  totBytes
235  .precision(0)
236  .prereq(totBytes);
237 
239  .precision(0)
240  .prereq(totBytes);
241 
243  .precision(0)
244  .prereq(txBytes);
245 
247  .precision(0)
248  .prereq(rxBytes);
249 
250  postedSwi
251  .precision(0);
252 
253  totalSwi
254  .precision(0);
255 
257  .precision(0);
258 
260  .precision(0);
261 
263  .precision(0);
264 
266  .precision(0);
267 
268  postedRxOk
269  .precision(0);
270 
271  totalRxOk
272  .precision(0);
273 
275  .precision(0);
276 
278  .precision(0);
279 
281  .precision(0);
282 
284  .precision(0);
285 
286  postedTxOk
287  .precision(0);
288 
289  totalTxOk
290  .precision(0);
291 
293  .precision(0);
294 
296  .precision(0);
297 
299  .precision(0);
300 
302  .precision(0);
303 
305  .precision(0);
306 
308  .precision(0);
309 
311  .precision(0);
312 
314  .precision(0);
315 
316  totalRxOrn
317  .precision(0);
318 
320  .precision(0);
321 
323  .precision(0);
324 
326  .precision(0);
327 
331 }
332 
333 } // namespace gem5
gem5::EtherDevice::EtherDeviceStats::totalSwi
statistics::Scalar totalSwi
Definition: etherdevice.hh:97
gem5::EtherDevice::EtherDeviceStats::txBandwidth
statistics::Formula txBandwidth
Definition: etherdevice.hh:70
gem5::EtherDevice::EtherDeviceStats::postedRxOrn
statistics::Scalar postedRxOrn
Definition: etherdevice.hh:124
gem5::EtherDevice::EtherDeviceStats::totalRxDesc
statistics::Scalar totalRxDesc
Definition: etherdevice.hh:109
gem5::EtherDevice::EtherDeviceStats::coalescedSwi
statistics::Formula coalescedSwi
Definition: etherdevice.hh:98
gem5::EtherDevice::EtherDeviceStats::descDmaWrBytes
statistics::Scalar descDmaWrBytes
Definition: etherdevice.hh:86
gem5::EtherDevice::EtherDeviceStats::totPacketRate
statistics::Formula totPacketRate
Definition: etherdevice.hh:91
gem5::EtherDevice::EtherDeviceStats::rxBandwidth
statistics::Formula rxBandwidth
Definition: etherdevice.hh:71
gem5::EtherDevice::EtherDeviceStats::postedRxOk
statistics::Scalar postedRxOk
Definition: etherdevice.hh:104
gem5::EtherDevice::EtherDeviceStats::postedRxDesc
statistics::Scalar postedRxDesc
Definition: etherdevice.hh:108
gem5::EtherDevice::EtherDeviceStats::txUdpChecksums
statistics::Scalar txUdpChecksums
Definition: etherdevice.hh:79
gem5::EtherDevice::EtherDeviceStats::txPacketRate
statistics::Formula txPacketRate
Definition: etherdevice.hh:93
gem5::EtherDevice::EtherDeviceStats::totalTxIdle
statistics::Scalar totalTxIdle
Definition: etherdevice.hh:117
gem5::EtherDevice::EtherDeviceStats::totalTxDesc
statistics::Scalar totalTxDesc
Definition: etherdevice.hh:121
gem5::EtherDevice::EtherDeviceStats::postedTxDesc
statistics::Scalar postedTxDesc
Definition: etherdevice.hh:120
gem5::EtherDevice::EtherDeviceStats::coalescedRxOk
statistics::Formula coalescedRxOk
Definition: etherdevice.hh:106
gem5::EtherDevice::EtherDeviceStats::txPackets
statistics::Scalar txPackets
Definition: etherdevice.hh:67
gem5::statistics::constant
Temp constant(T val)
Definition: statistics.hh:2865
gem5::EtherDevice::EtherDeviceStats::postedInterrupts
statistics::Scalar postedInterrupts
Definition: etherdevice.hh:62
gem5::EtherDevice::EtherDeviceStats::descDmaWrites
statistics::Scalar descDmaWrites
Definition: etherdevice.hh:83
gem5::EtherDevice::EtherDeviceStats::txTcpChecksums
statistics::Scalar txTcpChecksums
Definition: etherdevice.hh:76
stats.hh
gem5::EtherDevice::EtherDeviceStats::totalRxOrn
statistics::Scalar totalRxOrn
Definition: etherdevice.hh:125
gem5::EtherDevice::EtherDeviceStats::rxPacketRate
statistics::Formula rxPacketRate
Definition: etherdevice.hh:94
gem5::EtherDevice::EtherDeviceStats::coalescedTxIdle
statistics::Formula coalescedTxIdle
Definition: etherdevice.hh:118
gem5::EtherDevice::EtherDeviceStats::totalRxIdle
statistics::Scalar totalRxIdle
Definition: etherdevice.hh:101
ADD_STAT
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
Definition: group.hh:75
gem5::EtherDevice::EtherDeviceStats::totalRxOk
statistics::Scalar totalRxOk
Definition: etherdevice.hh:105
gem5::EtherDevice::EtherDeviceStats::totBandwidth
statistics::Formula totBandwidth
Definition: etherdevice.hh:88
gem5::EtherDevice::EtherDeviceStats::rxIpChecksums
statistics::Scalar rxIpChecksums
Definition: etherdevice.hh:74
gem5::EtherDevice::EtherDeviceStats::rxUdpChecksums
statistics::Scalar rxUdpChecksums
Definition: etherdevice.hh:80
gem5::statistics::DataWrap::precision
Derived & precision(int _precision)
Set the precision and marks this stat to print at the end of simulation.
Definition: statistics.hh:346
gem5::EtherDevice::EtherDeviceStats::rxBytes
statistics::Scalar rxBytes
Definition: etherdevice.hh:65
gem5::EtherDevice::EtherDeviceStats::totBytes
statistics::Formula totBytes
Definition: etherdevice.hh:90
gem5::EtherDevice::EtherDeviceStats::descDmaReads
statistics::Scalar descDmaReads
Definition: etherdevice.hh:82
gem5::EtherDevice::EtherDeviceStats::coalescedRxIdle
statistics::Formula coalescedRxIdle
Definition: etherdevice.hh:102
gem5::EtherDevice::EtherDeviceStats::coalescedTotal
statistics::Formula coalescedTotal
Definition: etherdevice.hh:128
gem5::EtherDevice::EtherDeviceStats::coalescedRxDesc
statistics::Formula coalescedRxDesc
Definition: etherdevice.hh:110
gem5::EtherDevice::EtherDeviceStats::postedTxOk
statistics::Scalar postedTxOk
Definition: etherdevice.hh:112
gem5::statistics::DataWrap::prereq
Derived & prereq(const Stat &prereq)
Set the prerequisite stat and marks this stat to print at the end of simulation.
Definition: statistics.hh:372
gem5::EtherDevice::EtherDeviceStats::totPackets
statistics::Formula totPackets
Definition: etherdevice.hh:89
gem5::EtherDevice::EtherDeviceStats::coalescedTxOk
statistics::Formula coalescedTxOk
Definition: etherdevice.hh:114
gem5::EtherDevice::EtherDeviceStats::rxPackets
statistics::Scalar rxPackets
Definition: etherdevice.hh:68
gem5::EtherDevice::EtherDeviceStats::postedTxIdle
statistics::Scalar postedTxIdle
Definition: etherdevice.hh:116
gem5::EtherDevice::EtherDeviceStats::postedSwi
statistics::Scalar postedSwi
Definition: etherdevice.hh:96
gem5::EtherDevice::EtherDeviceStats::txBytes
statistics::Scalar txBytes
Definition: etherdevice.hh:64
gem5::simSeconds
statistics::Formula & simSeconds
Definition: stats.cc:45
gem5::statistics::Group
Statistics container.
Definition: group.hh:93
gem5::EtherDevice::EtherDeviceStats::coalescedRxOrn
statistics::Formula coalescedRxOrn
Definition: etherdevice.hh:126
gem5::EtherDevice::EtherDeviceStats::rxTcpChecksums
statistics::Scalar rxTcpChecksums
Definition: etherdevice.hh:77
gem5::EtherDevice::EtherDeviceStats::totalTxOk
statistics::Scalar totalTxOk
Definition: etherdevice.hh:113
etherdevice.hh
gem5::EtherDevice::EtherDeviceStats::EtherDeviceStats
EtherDeviceStats(statistics::Group *parent)
Definition: etherdevice.cc:36
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::EtherDevice::EtherDeviceStats::postedRxIdle
statistics::Scalar postedRxIdle
Definition: etherdevice.hh:100
gem5::EtherDevice::EtherDeviceStats::droppedPackets
statistics::Scalar droppedPackets
Definition: etherdevice.hh:129
gem5::EtherDevice::EtherDeviceStats::coalescedTxDesc
statistics::Formula coalescedTxDesc
Definition: etherdevice.hh:122
gem5::EtherDevice::EtherDeviceStats::descDmaRdBytes
statistics::Scalar descDmaRdBytes
Definition: etherdevice.hh:85
gem5::EtherDevice::EtherDeviceStats::txIpChecksums
statistics::Scalar txIpChecksums
Definition: etherdevice.hh:73

Generated on Sat Jun 18 2022 08:12:24 for gem5 by doxygen 1.8.17