o3cpu: give a name to the activity recorder for better tracing

This commit is contained in:
Nathan Binkert 2009-01-21 14:56:18 -08:00
parent dbac448b08
commit 10fc45da27
3 changed files with 17 additions and 8 deletions

View file

@ -28,15 +28,18 @@
* Authors: Kevin Lim * Authors: Kevin Lim
*/ */
#include <cstring> #include <string>
#include "base/timebuf.hh" #include "base/timebuf.hh"
#include "cpu/activity.hh" #include "cpu/activity.hh"
ActivityRecorder::ActivityRecorder(int num_stages, int longest_latency, using namespace std;
int activity)
: activityBuffer(longest_latency, 0), longestLatency(longest_latency), ActivityRecorder::ActivityRecorder(const string &name, int num_stages,
activityCount(activity), numStages(num_stages) int longest_latency, int activity)
: _name(name), activityBuffer(longest_latency, 0),
longestLatency(longest_latency), activityCount(activity),
numStages(num_stages)
{ {
stageActive = new bool[numStages]; stageActive = new bool[numStages];
std::memset(stageActive, 0, numStages); std::memset(stageActive, 0, numStages);

View file

@ -49,9 +49,11 @@
* idle. If count is zero, then the CPU can safely idle as it has no * idle. If count is zero, then the CPU can safely idle as it has no
* more outstanding work to do. * more outstanding work to do.
*/ */
class ActivityRecorder { class ActivityRecorder
{
public: public:
ActivityRecorder(int num_stages, int longest_latency, int count); ActivityRecorder(const std::string &name, int num_stages,
int longest_latency, int count);
/** Records that there is activity this cycle. */ /** Records that there is activity this cycle. */
void activity(); void activity();
@ -92,6 +94,10 @@ class ActivityRecorder {
void validate(); void validate();
private: private:
// provide name() for DPRINTF.
std::string _name;
const std::string &name() { return _name; }
/** Time buffer that tracks if any cycles has active communication /** Time buffer that tracks if any cycles has active communication
* in them. It should be as long as the longest communication * in them. It should be as long as the longest communication
* latency in the system. Each time any time buffer is written, * latency in the system. Each time any time buffer is written,

View file

@ -192,7 +192,7 @@ FullO3CPU<Impl>::FullO3CPU(DerivO3CPUParams *params)
decodeQueue(params->backComSize, params->forwardComSize), decodeQueue(params->backComSize, params->forwardComSize),
renameQueue(params->backComSize, params->forwardComSize), renameQueue(params->backComSize, params->forwardComSize),
iewQueue(params->backComSize, params->forwardComSize), iewQueue(params->backComSize, params->forwardComSize),
activityRec(NumStages, activityRec(name(), NumStages,
params->backComSize + params->forwardComSize, params->backComSize + params->forwardComSize,
params->activity), params->activity),