X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fcpu%2Factivity.hh;h=f8d57f1afc854f44ee9a80ff59556b2837383907;hb=707275265f188a514d1d5673ed4c8d6495304962;hp=e99927339f4802bab9b72aa38fc50771820f8e0b;hpb=15a8f050605919579e81b6abb98a0b596334216d;p=gem5.git diff --git a/src/cpu/activity.hh b/src/cpu/activity.hh index e99927339..f8d57f1af 100644 --- a/src/cpu/activity.hh +++ b/src/cpu/activity.hh @@ -31,8 +31,8 @@ #ifndef __CPU_ACTIVITY_HH__ #define __CPU_ACTIVITY_HH__ -#include "base/timebuf.hh" #include "base/trace.hh" +#include "cpu/timebuf.hh" /** * ActivityRecorder helper class that informs the CPU if it can switch @@ -49,9 +49,12 @@ * idle. If count is zero, then the CPU can safely idle as it has no * more outstanding work to do. */ -class ActivityRecorder { +class ActivityRecorder +{ public: - ActivityRecorder(int num_stages, int longest_latency, int count); + ActivityRecorder(const std::string &name, int num_stages, + int longest_latency, int count); + ~ActivityRecorder(); /** Records that there is activity this cycle. */ void activity(); @@ -68,8 +71,14 @@ class ActivityRecorder { /** Deactivates a stage. */ void deactivateStage(const int idx); + /** Returns the activity status of a stage. */ + bool getStageActive(const int idx) const { return stageActive[idx]; } + + /** Returns the number of stages. */ + int getNumStages() const { return numStages; } + /** Returns how many things are active within the recorder. */ - int getActivityCount() { return activityCount; } + int getActivityCount() const { return activityCount; } /** Sets the count to a starting value. Can be used to disable * the idling option. @@ -91,7 +100,12 @@ class ActivityRecorder { */ void validate(); + const std::string &name() const { return _name; } + private: + // provide name() for DPRINTF. + std::string _name; + /** Time buffer that tracks if any cycles has active communication * in them. It should be as long as the longest communication * latency in the system. Each time any time buffer is written,