From 51aa7e4a0392d5e8f98bd7a4d09f4026dd21bd0a Mon Sep 17 00:00:00 2001 From: Prakash Ramrakhyani Date: Mon, 9 Jan 2012 18:08:20 -0600 Subject: sim: Enable sampling of run-time for code-sections marked using pseudo insts. This patch adds a mechanism to collect run time samples for specific portions of a benchmark, using work_begin and work_end pseudo instructions.It also enhances the histogram stat to report geometric mean. --- src/sim/system.hh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/sim/system.hh') diff --git a/src/sim/system.hh b/src/sim/system.hh index ed5193dfd..44383c399 100644 --- a/src/sim/system.hh +++ b/src/sim/system.hh @@ -171,14 +171,16 @@ class System : public SimObject Enums::MemoryMode memoryMode; uint64_t workItemsBegin; uint64_t workItemsEnd; + uint32_t numWorkIds; std::vector activeCpus; public: + virtual void regStats(); /** * Called by pseudo_inst to track the number of work items started by this * system. */ - uint64_t + uint64_t incWorkItemsBegin() { return ++workItemsBegin; @@ -212,6 +214,14 @@ class System : public SimObject return count; } + inline void workItemBegin(uint32_t tid, uint32_t workid) + { + std::pair p(tid, workid); + lastWorkItemStarted[p] = curTick(); + } + + void workItemEnd(uint32_t tid, uint32_t workid); + #if FULL_SYSTEM /** * Fix up an address used to match PCs for hooking simulator @@ -303,6 +313,8 @@ class System : public SimObject public: Counter totalNumInsts; EventQueue instEventQueue; + std::map, Tick> lastWorkItemStarted; + std::map workItemStats; //////////////////////////////////////////// // -- cgit v1.2.3