From 14539ccae19098a26a7048f475f3ffd44b711f5d Mon Sep 17 00:00:00 2001 From: Dam Sunwoo Date: Tue, 5 Jun 2012 01:23:11 -0400 Subject: Mem: add per-master stats to physmem Added per-master stats (similar to cache stats) to physmem. --- src/mem/abstract_mem.hh | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) (limited to 'src/mem/abstract_mem.hh') diff --git a/src/mem/abstract_mem.hh b/src/mem/abstract_mem.hh index 42ad08e5c..7b7e41913 100644 --- a/src/mem/abstract_mem.hh +++ b/src/mem/abstract_mem.hh @@ -53,6 +53,9 @@ #include "params/AbstractMemory.hh" #include "sim/stats.hh" + +class System; + /** * An abstract memory represents a contiguous block of physical * memory, with an associated address range, and also provides basic @@ -140,17 +143,17 @@ class AbstractMemory : public MemObject } /** Number of total bytes read from this memory */ - Stats::Scalar bytesRead; + Stats::Vector bytesRead; /** Number of instruction bytes read from this memory */ - Stats::Scalar bytesInstRead; + Stats::Vector bytesInstRead; /** Number of bytes written to this memory */ - Stats::Scalar bytesWritten; + Stats::Vector bytesWritten; /** Number of read requests */ - Stats::Scalar numReads; + Stats::Vector numReads; /** Number of write requests */ - Stats::Scalar numWrites; + Stats::Vector numWrites; /** Number of other requests */ - Stats::Scalar numOther; + Stats::Vector numOther; /** Read bandwidth from this memory */ Stats::Formula bwRead; /** Read bandwidth from this memory */ @@ -160,6 +163,13 @@ class AbstractMemory : public MemObject /** Total bandwidth from this memory */ Stats::Formula bwTotal; + /** Pointor to the System object. + * This is used for getting the number of masters in the system which is + * needed when registering stats + */ + System *_system; + + private: // Prevent copying @@ -175,6 +185,19 @@ class AbstractMemory : public MemObject AbstractMemory(const Params* p); virtual ~AbstractMemory(); + /** read the system pointer + * Implemented for completeness with the setter + * @return pointer to the system object */ + System* system() const { return _system; } + + /** Set the system pointer on this memory + * This can't be done via a python parameter because the system needs + * pointers to all the memories and the reverse would create a cycle in the + * object graph. An init() this is set. + * @param sys system pointer to set + */ + void system(System *sys) { _system = sys; } + const Params * params() const { -- cgit v1.2.3