dev: Fixing EtherDevice stats initialization order
authorHoa Nguyen <hoanguyen@ucdavis.edu>
Tue, 19 Jan 2021 18:05:47 +0000 (10:05 -0800)
committerHoa Nguyen <hoanguyen@ucdavis.edu>
Thu, 21 Jan 2021 03:05:26 +0000 (03:05 +0000)
commit71932a360da6107f934cbb78cdcc20e7bbd582fe
treefa373c80e77b2046ae791056bc0dedfb0f0bcea8
parenta3c260094f0231dea6da28d3490b2d5b4d7ef85a
dev: Fixing EtherDevice stats initialization order

Previously, the stat `totalBandwidth` is initialized before
`txBandwidth` and `rxBandwidth`. However, `totalBandwith` is of
 type Stats::Formula and `totalBandwidth = txBandwidth + 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 <hoanguyen@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39395
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/dev/net/etherdevice.cc
src/dev/net/etherdevice.hh