From: Javier Cano-Cano Date: Tue, 6 Jun 2017 14:10:26 +0000 (+0200) Subject: mem-garnet: Fix garnet stats X-Git-Tag: v19.0.0.0~2748 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b377217202305784f91ffe719f9c04f54ad24145;p=gem5.git mem-garnet: Fix garnet stats This patch fix some statistics that in presence of a resetStats instruction were not reseted. This bug makes impossible to obtain reliable network statistics when the simulation doesn't start from tick zero. Change-Id: Ibec45f08d95bf0a533d94b70ec960719206ae945 Maintainer: Tushar Krishna Reviewed-on: https://gem5-review.googlesource.com/3700 Reviewed-by: Jieming Yin Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power --- diff --git a/src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc b/src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc index 340f56d61..fbaf25b7d 100644 --- a/src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc +++ b/src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc @@ -110,3 +110,9 @@ CrossbarSwitch::functionalWrite(Packet *pkt) return num_functional_writes; } + +void +CrossbarSwitch::resetStats() +{ + m_crossbar_activity = 0; +} \ No newline at end of file diff --git a/src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh b/src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh index 7aaeabf0c..bca3a92e4 100644 --- a/src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh +++ b/src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh @@ -59,6 +59,7 @@ class CrossbarSwitch : public Consumer inline double get_crossbar_activity() { return m_crossbar_activity; } uint32_t functionalWrite(Packet *pkt); + void resetStats(); private: int m_num_vcs; diff --git a/src/mem/ruby/network/garnet2.0/NetworkLink.cc b/src/mem/ruby/network/garnet2.0/NetworkLink.cc index 6010071f0..e718fb867 100644 --- a/src/mem/ruby/network/garnet2.0/NetworkLink.cc +++ b/src/mem/ruby/network/garnet2.0/NetworkLink.cc @@ -75,6 +75,16 @@ NetworkLink::wakeup() } } +void +NetworkLink::resetStats() +{ + for (int i = 0; i < m_vc_load.size(); i++) { + m_vc_load[i] = 0; + } + + m_link_utilized = 0; +} + NetworkLink * NetworkLinkParams::create() { diff --git a/src/mem/ruby/network/garnet2.0/NetworkLink.hh b/src/mem/ruby/network/garnet2.0/NetworkLink.hh index cb69b39ad..10399ec37 100644 --- a/src/mem/ruby/network/garnet2.0/NetworkLink.hh +++ b/src/mem/ruby/network/garnet2.0/NetworkLink.hh @@ -70,6 +70,7 @@ class NetworkLink : public ClockedObject, public Consumer inline flit* consumeLink() { return linkBuffer->getTopFlit(); } uint32_t functionalWrite(Packet *); + void resetStats(); private: const int m_id; diff --git a/src/mem/ruby/network/garnet2.0/Router.cc b/src/mem/ruby/network/garnet2.0/Router.cc index 65a730096..7266f998a 100644 --- a/src/mem/ruby/network/garnet2.0/Router.cc +++ b/src/mem/ruby/network/garnet2.0/Router.cc @@ -241,6 +241,9 @@ Router::resetStats() m_input_unit[i]->resetStats(); } } + + m_switch->resetStats(); + m_sw_alloc->resetStats(); } void diff --git a/src/mem/ruby/network/garnet2.0/SwitchAllocator.cc b/src/mem/ruby/network/garnet2.0/SwitchAllocator.cc index 4619b0b8a..836f071fe 100644 --- a/src/mem/ruby/network/garnet2.0/SwitchAllocator.cc +++ b/src/mem/ruby/network/garnet2.0/SwitchAllocator.cc @@ -387,3 +387,10 @@ SwitchAllocator::clear_request_vector() } } } + +void +SwitchAllocator::resetStats() +{ + m_input_arbiter_activity = 0; + m_output_arbiter_activity = 0; +} \ No newline at end of file diff --git a/src/mem/ruby/network/garnet2.0/SwitchAllocator.hh b/src/mem/ruby/network/garnet2.0/SwitchAllocator.hh index 162264e85..7515b734f 100644 --- a/src/mem/ruby/network/garnet2.0/SwitchAllocator.hh +++ b/src/mem/ruby/network/garnet2.0/SwitchAllocator.hh @@ -70,6 +70,8 @@ class SwitchAllocator : public Consumer return m_output_arbiter_activity; } + void resetStats(); + private: int m_num_inports, m_num_outports; int m_num_vcs, m_vc_per_vnet;