2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
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.
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.
28 * Authors: Nathan Binkert
32 #include "dev/etherdevice.hh"
33 #include "sim/stats.hh"
36 EtherDevice::regStats()
39 .name(name() + ".txBytes")
40 .desc("Bytes Transmitted")
45 .name(name() + ".rxBytes")
46 .desc("Bytes Received")
51 .name(name() + ".txPackets")
52 .desc("Number of Packets Transmitted")
57 .name(name() + ".rxPackets")
58 .desc("Number of Packets Received")
63 .name(name() + ".txIpChecksums")
64 .desc("Number of tx IP Checksums done by device")
70 .name(name() + ".rxIpChecksums")
71 .desc("Number of rx IP Checksums done by device")
77 .name(name() + ".txTcpChecksums")
78 .desc("Number of tx TCP Checksums done by device")
84 .name(name() + ".rxTcpChecksums")
85 .desc("Number of rx TCP Checksums done by device")
91 .name(name() + ".txUdpChecksums")
92 .desc("Number of tx UDP Checksums done by device")
98 .name(name() + ".rxUdpChecksums")
99 .desc("Number of rx UDP Checksums done by device")
105 .name(name() + ".descDMAReads")
106 .desc("Number of descriptors the device read w/ DMA")
111 .name(name() + ".descDMAWrites")
112 .desc("Number of descriptors the device wrote w/ DMA")
117 .name(name() + ".descDmaReadBytes")
118 .desc("number of descriptor bytes read w/ DMA")
123 .name(name() + ".descDmaWriteBytes")
124 .desc("number of descriptor bytes write w/ DMA")
129 .name(name() + ".txBandwidth")
130 .desc("Transmit Bandwidth (bits/s)")
136 .name(name() + ".rxBandwidth")
137 .desc("Receive Bandwidth (bits/s)")
143 .name(name() + ".totBandwidth")
144 .desc("Total Bandwidth (bits/s)")
150 .name(name() + ".totPackets")
151 .desc("Total Packets")
157 .name(name() + ".totBytes")
164 .name(name() + ".totPPS")
165 .desc("Total Tranmission Rate (packets/s)")
171 .name(name() + ".txPPS")
172 .desc("Packet Tranmission Rate (packets/s)")
178 .name(name() + ".rxPPS")
179 .desc("Packet Reception Rate (packets/s)")
185 .name(name() + ".postedSwi")
186 .desc("number of software interrupts posted to CPU")
191 .name(name() + ".totalSwi")
192 .desc("total number of Swi written to ISR")
197 .name(name() + ".coalescedSwi")
198 .desc("average number of Swi's coalesced into each post")
203 .name(name() + ".postedRxIdle")
204 .desc("number of rxIdle interrupts posted to CPU")
209 .name(name() + ".totalRxIdle")
210 .desc("total number of RxIdle written to ISR")
215 .name(name() + ".coalescedRxIdle")
216 .desc("average number of RxIdle's coalesced into each post")
221 .name(name() + ".postedRxOk")
222 .desc("number of RxOk interrupts posted to CPU")
227 .name(name() + ".totalRxOk")
228 .desc("total number of RxOk written to ISR")
233 .name(name() + ".coalescedRxOk")
234 .desc("average number of RxOk's coalesced into each post")
239 .name(name() + ".postedRxDesc")
240 .desc("number of RxDesc interrupts posted to CPU")
245 .name(name() + ".totalRxDesc")
246 .desc("total number of RxDesc written to ISR")
251 .name(name() + ".coalescedRxDesc")
252 .desc("average number of RxDesc's coalesced into each post")
257 .name(name() + ".postedTxOk")
258 .desc("number of TxOk interrupts posted to CPU")
263 .name(name() + ".totalTxOk")
264 .desc("total number of TxOk written to ISR")
269 .name(name() + ".coalescedTxOk")
270 .desc("average number of TxOk's coalesced into each post")
275 .name(name() + ".postedTxIdle")
276 .desc("number of TxIdle interrupts posted to CPU")
281 .name(name() + ".totalTxIdle")
282 .desc("total number of TxIdle written to ISR")
287 .name(name() + ".coalescedTxIdle")
288 .desc("average number of TxIdle's coalesced into each post")
293 .name(name() + ".postedTxDesc")
294 .desc("number of TxDesc interrupts posted to CPU")
299 .name(name() + ".totalTxDesc")
300 .desc("total number of TxDesc written to ISR")
305 .name(name() + ".coalescedTxDesc")
306 .desc("average number of TxDesc's coalesced into each post")
311 .name(name() + ".postedRxOrn")
312 .desc("number of RxOrn posted to CPU")
317 .name(name() + ".totalRxOrn")
318 .desc("total number of RxOrn written to ISR")
323 .name(name() + ".coalescedRxOrn")
324 .desc("average number of RxOrn's coalesced into each post")
329 .name(name() + ".coalescedTotal")
330 .desc("average number of interrupts coalesced into each post")
335 .name(name() + ".postedInterrupts")
336 .desc("number of posts to CPU")
341 .name(name() + ".droppedPackets")
342 .desc("number of packets dropped")
346 coalescedSwi
= totalSwi
/ postedInterrupts
;
347 coalescedRxIdle
= totalRxIdle
/ postedInterrupts
;
348 coalescedRxOk
= totalRxOk
/ postedInterrupts
;
349 coalescedRxDesc
= totalRxDesc
/ postedInterrupts
;
350 coalescedTxOk
= totalTxOk
/ postedInterrupts
;
351 coalescedTxIdle
= totalTxIdle
/ postedInterrupts
;
352 coalescedTxDesc
= totalTxDesc
/ postedInterrupts
;
353 coalescedRxOrn
= totalRxOrn
/ postedInterrupts
;
355 coalescedTotal
= (totalSwi
+ totalRxIdle
+ totalRxOk
+ totalRxDesc
+
356 totalTxOk
+ totalTxIdle
+ totalTxDesc
+
357 totalRxOrn
) / postedInterrupts
;
359 txBandwidth
= txBytes
* Stats::constant(8) / simSeconds
;
360 rxBandwidth
= rxBytes
* Stats::constant(8) / simSeconds
;
361 totBandwidth
= txBandwidth
+ rxBandwidth
;
362 totBytes
= txBytes
+ rxBytes
;
363 totPackets
= txPackets
+ rxPackets
;
365 txPacketRate
= txPackets
/ simSeconds
;
366 rxPacketRate
= rxPackets
/ simSeconds
;
367 totPacketRate
= totPackets
/ simSeconds
;