Hoa Nguyen has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/39395 )

Change subject: dev: Fixing EtherDevice stats initialization order
......................................................................

dev: Fixing EtherDevice stats initialization order

Previously, the stat `totalBandwidth` is initialized before `txBandwidth`
and `rxBandwidth`. However, `totalBandwith` is of type Stats::Formula
and it uses the values of `txBandwidth` and `rxBandwidth`.
Therefore, `totalBandwidth` should be initialized after the other two.

This change fixes the variable and stats initialization order accordingly.

The bug was reported here: https://github.com/gem5/gem5/commit/3db48cbbc6e475592e6608b52a870d92ac2214aa#commitcomment-46094633.

Jira: https://gem5.atlassian.net/browse/GEM5-894

Change-Id: I2c7cc4120df672edf15b9a3ab6becc0bbebb778b
Signed-off-by: Hoa Nguyen <hoangu...@ucdavis.edu>
---
M src/dev/net/etherdevice.cc
M src/dev/net/etherdevice.hh
2 files changed, 7 insertions(+), 7 deletions(-)



diff --git a/src/dev/net/etherdevice.cc b/src/dev/net/etherdevice.cc
index 64ab438..e279a9c 100644
--- a/src/dev/net/etherdevice.cc
+++ b/src/dev/net/etherdevice.cc
@@ -37,6 +37,10 @@
       ADD_STAT(rxBytes, "Bytes Received"),
       ADD_STAT(txPackets, "Number of Packets Transmitted"),
       ADD_STAT(rxPackets, "Number of Packets Received"),
+      ADD_STAT(txBandwidth, "Transmit Bandwidth (bits/s)",
+               txBytes * Stats::constant(8) / simSeconds),
+      ADD_STAT(rxBandwidth, "Receive Bandwidth (bits/s)",
+               rxBytes * Stats::constant(8) / simSeconds),
       ADD_STAT(txIpChecksums, "Number of tx IP Checksums done by device"),
       ADD_STAT(rxIpChecksums, "Number of rx IP Checksums done by device"),
ADD_STAT(txTcpChecksums, "Number of tx TCP Checksums done by device"),
@@ -53,10 +57,6 @@
       ADD_STAT(totBytes, "Total Bytes", txBytes + rxBytes),
       ADD_STAT(totPacketRate, "Total Tranmission Rate (packets/s)",
                totPackets / simSeconds),
-      ADD_STAT(txBandwidth, "Transmit Bandwidth (bits/s)",
-               txBytes * Stats::constant(8) / simSeconds),
-      ADD_STAT(rxBandwidth, "Receive Bandwidth (bits/s)",
-               rxBytes * Stats::constant(8) / simSeconds),
       ADD_STAT(txPacketRate, "Packet Tranmission Rate (packets/s)",
                txPackets / simSeconds),
       ADD_STAT(rxPacketRate, "Packet Reception Rate (packets/s)",
diff --git a/src/dev/net/etherdevice.hh b/src/dev/net/etherdevice.hh
index 0cc54d0..a853cd8 100644
--- a/src/dev/net/etherdevice.hh
+++ b/src/dev/net/etherdevice.hh
@@ -70,6 +70,9 @@
         Stats::Scalar txPackets;
         Stats::Scalar rxPackets;

+        Stats::Formula txBandwidth;
+        Stats::Formula rxBandwidth;
+
         Stats::Scalar txIpChecksums;
         Stats::Scalar rxIpChecksums;

@@ -90,9 +93,6 @@
         Stats::Formula totBytes;
         Stats::Formula totPacketRate;

-        Stats::Formula txBandwidth;
-        Stats::Formula rxBandwidth;
-
         Stats::Formula txPacketRate;
         Stats::Formula rxPacketRate;


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39395
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I2c7cc4120df672edf15b9a3ab6becc0bbebb778b
Gerrit-Change-Number: 39395
Gerrit-PatchSet: 1
Gerrit-Owner: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to