gem5  v21.1.0.2
activity.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2006 The Regents of The University of Michigan
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met: redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef __CPU_ACTIVITY_HH__
30 #define __CPU_ACTIVITY_HH__
31 
32 #include "base/trace.hh"
33 #include "cpu/timebuf.hh"
34 
35 namespace gem5
36 {
37 
54 {
55  public:
56  ActivityRecorder(const std::string &name, int num_stages,
57  int longest_latency, int count);
59 
61  void activity();
62 
67  void advance();
68 
70  void activateStage(const int idx);
71 
73  void deactivateStage(const int idx);
74 
76  bool getStageActive(const int idx) const { return stageActive[idx]; }
77 
79  int getNumStages() const { return numStages; }
80 
82  int getActivityCount() const { return activityCount; }
83 
88  { activityCount = count; }
89 
91  bool active() { return activityCount; }
92 
94  void reset();
95 
97  void dump();
98 
102  void validate();
103 
104  const std::string &name() const { return _name; }
105 
106  private:
107  // provide name() for DPRINTF.
108  std::string _name;
109 
119 
122 
133 
136 
138  bool *stageActive;
139 };
140 
141 } // namespace gem5
142 
143 #endif // __CPU_ACTIVITY_HH__
gem5::ActivityRecorder::stageActive
bool * stageActive
Records which stages are active/inactive.
Definition: activity.hh:138
gem5::ActivityRecorder::advance
void advance()
Advances the activity buffer, decrementing the activityCount if active communication just left the ti...
Definition: activity.cc:71
gem5::ActivityRecorder::getActivityCount
int getActivityCount() const
Returns how many things are active within the recorder.
Definition: activity.hh:82
gem5::ActivityRecorder::numStages
int numStages
Number of stages that can be marked as active or inactive.
Definition: activity.hh:135
gem5::TimeBuffer< bool >
gem5::ActivityRecorder::activityBuffer
TimeBuffer< bool > activityBuffer
Time buffer that tracks if any cycles has active communication in them.
Definition: activity.hh:118
timebuf.hh
gem5::ActivityRecorder::getNumStages
int getNumStages() const
Returns the number of stages.
Definition: activity.hh:79
gem5::ActivityRecorder::dump
void dump()
Debug function to dump the contents of the time buffer.
Definition: activity.cc:134
gem5::X86ISA::count
count
Definition: misc.hh:709
gem5::ActivityRecorder::_name
std::string _name
Definition: activity.hh:108
gem5::ActivityRecorder::activity
void activity()
Records that there is activity this cycle.
Definition: activity.cc:55
gem5::ActivityRecorder::getStageActive
bool getStageActive(const int idx) const
Returns the activity status of a stage.
Definition: activity.hh:76
gem5::ActivityRecorder::reset
void reset()
Clears the time buffer and the activity count.
Definition: activity.cc:125
gem5::ActivityRecorder::activateStage
void activateStage(const int idx)
Marks a stage as active.
Definition: activity.cc:91
gem5::ActivityRecorder::longestLatency
int longestLatency
Longest latency time buffer in the CPU.
Definition: activity.hh:121
gem5::ActivityRecorder::name
const std::string & name() const
Definition: activity.hh:104
gem5::ActivityRecorder
ActivityRecorder helper class that informs the CPU if it can switch over to being idle or not.
Definition: activity.hh:53
trace.hh
gem5::ActivityRecorder::active
bool active()
Returns if the CPU should be active.
Definition: activity.hh:91
gem5::ActivityRecorder::activityCount
int activityCount
Tracks how many stages and cycles of time buffer have activity.
Definition: activity.hh:132
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::ActivityRecorder::deactivateStage
void deactivateStage(const int idx)
Deactivates a stage.
Definition: activity.cc:108
gem5::ActivityRecorder::validate
void validate()
Debug function to ensure that the activity count matches the contents of the time buffer.
Definition: activity.cc:152
gem5::ActivityRecorder::ActivityRecorder
ActivityRecorder(const std::string &name, int num_stages, int longest_latency, int count)
Definition: activity.cc:39
gem5::ActivityRecorder::~ActivityRecorder
~ActivityRecorder()
Definition: activity.cc:49
gem5::ActivityRecorder::setActivityCount
void setActivityCount(int count)
Sets the count to a starting value.
Definition: activity.hh:87

Generated on Tue Sep 21 2021 12:25:00 for gem5 by doxygen 1.8.17