diff options
Diffstat (limited to 'src/mem/ruby/slicc_interface')
-rw-r--r-- | src/mem/ruby/slicc_interface/AbstractController.cc | 40 | ||||
-rw-r--r-- | src/mem/ruby/slicc_interface/AbstractController.hh | 32 |
2 files changed, 26 insertions, 46 deletions
diff --git a/src/mem/ruby/slicc_interface/AbstractController.cc b/src/mem/ruby/slicc_interface/AbstractController.cc index e46158ca0..0f5a70a6e 100644 --- a/src/mem/ruby/slicc_interface/AbstractController.cc +++ b/src/mem/ruby/slicc_interface/AbstractController.cc @@ -31,8 +31,7 @@ #include "mem/ruby/system/System.hh" AbstractController::AbstractController(const Params *p) - : ClockedObject(p), Consumer(this), m_fully_busy_cycles(0), - m_request_count(0) + : ClockedObject(p), Consumer(this) { m_version = p->version; m_clusterID = p->cluster_id; @@ -54,44 +53,39 @@ void AbstractController::init() { params()->ruby_system->registerAbstractController(this); + m_delayHistogram.init(10); + uint32_t size = Network::getNumberOfVirtualNetworks(); + for (uint32_t i = 0; i < size; i++) { + m_delayVCHistogram.push_back(new Stats::Histogram()); + m_delayVCHistogram[i]->init(10); + } } void -AbstractController::clearStats() +AbstractController::resetStats() { - m_requestProfileMap.clear(); - m_request_count = 0; - - m_delayHistogram.clear(); - + m_delayHistogram.reset(); uint32_t size = Network::getNumberOfVirtualNetworks(); - m_delayVCHistogram.resize(size); for (uint32_t i = 0; i < size; i++) { - m_delayVCHistogram[i].clear(); - } - - Sequencer *seq = getSequencer(); - if (seq != NULL) { - seq->clearStats(); + m_delayVCHistogram[i]->reset(); } } void -AbstractController::profileRequest(const std::string &request) +AbstractController::regStats() { - m_request_count++; - - // if it doesn't exist, conveniently, it will be created with the - // default value which is 0 - m_requestProfileMap[request]++; + m_fully_busy_cycles + .name(name() + ".fully_busy_cycles") + .desc("cycles for which number of transistions == max transitions") + .flags(Stats::nozero); } void AbstractController::profileMsgDelay(uint32_t virtualNetwork, Cycles delay) { assert(virtualNetwork < m_delayVCHistogram.size()); - m_delayHistogram.add(delay); - m_delayVCHistogram[virtualNetwork].add(delay); + m_delayHistogram.sample(delay); + m_delayVCHistogram[virtualNetwork]->sample(delay); } void diff --git a/src/mem/ruby/slicc_interface/AbstractController.hh b/src/mem/ruby/slicc_interface/AbstractController.hh index 345eefa0a..ac577ed09 100644 --- a/src/mem/ruby/slicc_interface/AbstractController.hh +++ b/src/mem/ruby/slicc_interface/AbstractController.hh @@ -72,8 +72,8 @@ class AbstractController : public ClockedObject, public Consumer virtual void print(std::ostream & out) const = 0; virtual void wakeup() = 0; - virtual void clearStats() = 0; - virtual void regStats() = 0; + virtual void resetStats() = 0; + virtual void regStats(); virtual void recordCacheTrace(int cntrl, CacheRecorder* tr) = 0; virtual Sequencer* getSequencer() const = 0; @@ -99,14 +99,10 @@ class AbstractController : public ClockedObject, public Consumer public: MachineID getMachineID() const { return m_machineID; } - uint64_t getFullyBusyCycles() const { return m_fully_busy_cycles; } - uint64_t getRequestCount() const { return m_request_count; } - const std::map<std::string, uint64_t>& getRequestProfileMap() const - { return m_requestProfileMap; } - Histogram& getDelayHist() { return m_delayHistogram; } - Histogram& getDelayVCHist(uint32_t index) - { return m_delayVCHistogram[index]; } + Stats::Histogram& getDelayHist() { return m_delayHistogram; } + Stats::Histogram& getDelayVCHist(uint32_t index) + { return *(m_delayVCHistogram[index]); } MessageBuffer *getPeerQueue(uint32_t pid) { @@ -156,17 +152,12 @@ class AbstractController : public ClockedObject, public Consumer //! Counter for the number of cycles when the transitions carried out //! were equal to the maximum allowed - uint64_t m_fully_busy_cycles; - - //! Map for couting requests of different types. The controller should - //! call requisite function for updating the count. - std::map<std::string, uint64_t> m_requestProfileMap; - uint64_t m_request_count; + Stats::Scalar m_fully_busy_cycles; //! Histogram for profiling delay for the messages this controller //! cares for - Histogram m_delayHistogram; - std::vector<Histogram> m_delayVCHistogram; + Stats::Histogram m_delayHistogram; + std::vector<Stats::Histogram *> m_delayVCHistogram; //! Callback class used for collating statistics from all the //! controller of this type. @@ -177,12 +168,7 @@ class AbstractController : public ClockedObject, public Consumer public: virtual ~StatsCallback() {} - - StatsCallback(AbstractController *_ctr) - : ctr(_ctr) - { - } - + StatsCallback(AbstractController *_ctr) : ctr(_ctr) {} void process() {ctr->collateStats();} }; }; |