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/net/etherdevice.hh"
34 #include "sim/stats.hh"
37 EtherDevice::regStats()
39 PciDevice::regStats();
42 .name(name() + ".txBytes")
43 .desc("Bytes Transmitted")
48 .name(name() + ".rxBytes")
49 .desc("Bytes Received")
54 .name(name() + ".txPackets")
55 .desc("Number of Packets Transmitted")
60 .name(name() + ".rxPackets")
61 .desc("Number of Packets Received")
66 .name(name() + ".txIpChecksums")
67 .desc("Number of tx IP Checksums done by device")
73 .name(name() + ".rxIpChecksums")
74 .desc("Number of rx IP Checksums done by device")
80 .name(name() + ".txTcpChecksums")
81 .desc("Number of tx TCP Checksums done by device")
87 .name(name() + ".rxTcpChecksums")
88 .desc("Number of rx TCP Checksums done by device")
94 .name(name() + ".txUdpChecksums")
95 .desc("Number of tx UDP Checksums done by device")
101 .name(name() + ".rxUdpChecksums")
102 .desc("Number of rx UDP Checksums done by device")
108 .name(name() + ".descDMAReads")
109 .desc("Number of descriptors the device read w/ DMA")
114 .name(name() + ".descDMAWrites")
115 .desc("Number of descriptors the device wrote w/ DMA")
120 .name(name() + ".descDmaReadBytes")
121 .desc("number of descriptor bytes read w/ DMA")
126 .name(name() + ".descDmaWriteBytes")
127 .desc("number of descriptor bytes write w/ DMA")
132 .name(name() + ".txBandwidth")
133 .desc("Transmit Bandwidth (bits/s)")
139 .name(name() + ".rxBandwidth")
140 .desc("Receive Bandwidth (bits/s)")
146 .name(name() + ".totBandwidth")
147 .desc("Total Bandwidth (bits/s)")
153 .name(name() + ".totPackets")
154 .desc("Total Packets")
160 .name(name() + ".totBytes")
167 .name(name() + ".totPPS")
168 .desc("Total Tranmission Rate (packets/s)")
174 .name(name() + ".txPPS")
175 .desc("Packet Tranmission Rate (packets/s)")
181 .name(name() + ".rxPPS")
182 .desc("Packet Reception Rate (packets/s)")
188 .name(name() + ".postedSwi")
189 .desc("number of software interrupts posted to CPU")
194 .name(name() + ".totalSwi")
195 .desc("total number of Swi written to ISR")
200 .name(name() + ".coalescedSwi")
201 .desc("average number of Swi's coalesced into each post")
206 .name(name() + ".postedRxIdle")
207 .desc("number of rxIdle interrupts posted to CPU")
212 .name(name() + ".totalRxIdle")
213 .desc("total number of RxIdle written to ISR")
218 .name(name() + ".coalescedRxIdle")
219 .desc("average number of RxIdle's coalesced into each post")
224 .name(name() + ".postedRxOk")
225 .desc("number of RxOk interrupts posted to CPU")
230 .name(name() + ".totalRxOk")
231 .desc("total number of RxOk written to ISR")
236 .name(name() + ".coalescedRxOk")
237 .desc("average number of RxOk's coalesced into each post")
242 .name(name() + ".postedRxDesc")
243 .desc("number of RxDesc interrupts posted to CPU")
248 .name(name() + ".totalRxDesc")
249 .desc("total number of RxDesc written to ISR")
254 .name(name() + ".coalescedRxDesc")
255 .desc("average number of RxDesc's coalesced into each post")
260 .name(name() + ".postedTxOk")
261 .desc("number of TxOk interrupts posted to CPU")
266 .name(name() + ".totalTxOk")
267 .desc("total number of TxOk written to ISR")
272 .name(name() + ".coalescedTxOk")
273 .desc("average number of TxOk's coalesced into each post")
278 .name(name() + ".postedTxIdle")
279 .desc("number of TxIdle interrupts posted to CPU")
284 .name(name() + ".totalTxIdle")
285 .desc("total number of TxIdle written to ISR")
290 .name(name() + ".coalescedTxIdle")
291 .desc("average number of TxIdle's coalesced into each post")
296 .name(name() + ".postedTxDesc")
297 .desc("number of TxDesc interrupts posted to CPU")
302 .name(name() + ".totalTxDesc")
303 .desc("total number of TxDesc written to ISR")
308 .name(name() + ".coalescedTxDesc")
309 .desc("average number of TxDesc's coalesced into each post")
314 .name(name() + ".postedRxOrn")
315 .desc("number of RxOrn posted to CPU")
320 .name(name() + ".totalRxOrn")
321 .desc("total number of RxOrn written to ISR")
326 .name(name() + ".coalescedRxOrn")
327 .desc("average number of RxOrn's coalesced into each post")
332 .name(name() + ".coalescedTotal")
333 .desc("average number of interrupts coalesced into each post")
338 .name(name() + ".postedInterrupts")
339 .desc("number of posts to CPU")
344 .name(name() + ".droppedPackets")
345 .desc("number of packets dropped")
349 coalescedSwi
= totalSwi
/ postedInterrupts
;
350 coalescedRxIdle
= totalRxIdle
/ postedInterrupts
;
351 coalescedRxOk
= totalRxOk
/ postedInterrupts
;
352 coalescedRxDesc
= totalRxDesc
/ postedInterrupts
;
353 coalescedTxOk
= totalTxOk
/ postedInterrupts
;
354 coalescedTxIdle
= totalTxIdle
/ postedInterrupts
;
355 coalescedTxDesc
= totalTxDesc
/ postedInterrupts
;
356 coalescedRxOrn
= totalRxOrn
/ postedInterrupts
;
358 coalescedTotal
= (totalSwi
+ totalRxIdle
+ totalRxOk
+ totalRxDesc
+
359 totalTxOk
+ totalTxIdle
+ totalTxDesc
+
360 totalRxOrn
) / postedInterrupts
;
362 txBandwidth
= txBytes
* Stats::constant(8) / simSeconds
;
363 rxBandwidth
= rxBytes
* Stats::constant(8) / simSeconds
;
364 totBandwidth
= txBandwidth
+ rxBandwidth
;
365 totBytes
= txBytes
+ rxBytes
;
366 totPackets
= txPackets
+ rxPackets
;
368 txPacketRate
= txPackets
/ simSeconds
;
369 rxPacketRate
= rxPackets
/ simSeconds
;
370 totPacketRate
= totPackets
/ simSeconds
;