From dfa8cbeb06b7556753c26b97978924c1f4a24699 Mon Sep 17 00:00:00 2001 From: Brad Beckmann Date: Sun, 6 Feb 2011 22:14:19 -0800 Subject: m5: added work completed monitoring support --- src/sim/system.hh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'src/sim/system.hh') diff --git a/src/sim/system.hh b/src/sim/system.hh index 6c4f3e9ed..0be16247f 100644 --- a/src/sim/system.hh +++ b/src/sim/system.hh @@ -161,6 +161,48 @@ class System : public SimObject protected: Enums::MemoryMode memoryMode; + uint64_t workItemsBegin; + uint64_t workItemsEnd; + std::vector activeCpus; + + public: + /** + * Called by pseudo_inst to track the number of work items started by this + * system. + */ + uint64_t + incWorkItemsBegin() + { + return ++workItemsBegin; + } + + /** + * Called by pseudo_inst to track the number of work items completed by + * this system. + */ + uint64_t + incWorkItemsEnd() + { + return ++workItemsEnd; + } + + /** + * Called by pseudo_inst to mark the cpus actively executing work items. + * Returns the total number of cpus that have executed work item begin or + * ends. + */ + int + markWorkItem(int index) + { + int count = 0; + assert(index < activeCpus.size()); + activeCpus[index] = true; + for (std::vector::iterator i = activeCpus.begin(); + i < activeCpus.end(); i++) { + if (*i) count++; + } + return count; + } #if FULL_SYSTEM /** -- cgit v1.2.3