Replace curTick global variable with accessor functions.
This step makes it easy to replace the accessor functions (which still access a global variable) with ones that access per-thread curTick values.
This commit is contained in:
@@ -161,7 +161,7 @@ CPA::swSmBegin(ThreadContext *tc)
|
||||
StringWrap name(sys->name());
|
||||
|
||||
if (!sm[0])
|
||||
warn("Got null SM at tick %d\n", curTick);
|
||||
warn("Got null SM at tick %d\n", curTick());
|
||||
|
||||
int sysi = getSys(sys);
|
||||
int smi = getSm(sysi, sm, args[1]);
|
||||
@@ -273,7 +273,7 @@ CPA::doSwSmEnd(System *sys, int cpuid, string sm, uint64_t frame)
|
||||
DPRINTF(Annotate, "Ending machine: %s; end stack: %s\n", sm,
|
||||
smMap[smib-1].second.first);
|
||||
|
||||
warn("State machine stack not unwinding correctly at %d\n", curTick);
|
||||
warn("State machine stack not unwinding correctly at %d\n", curTick());
|
||||
} else {
|
||||
DPRINTF(Annotate,
|
||||
"State machine ending:%s sysi:%d id:%#x back:%d getSm:%d\n",
|
||||
@@ -316,7 +316,7 @@ CPA::swExplictBegin(ThreadContext *tc)
|
||||
DPRINTF(Annotate, "Explict begin of state %s\n", st);
|
||||
uint32_t flags = args[0];
|
||||
if (flags & FL_BAD)
|
||||
warn("BAD state encountered: at cycle %d: %s\n", curTick, st);
|
||||
warn("BAD state encountered: at cycle %d: %s\n", curTick(), st);
|
||||
swBegin(tc->getSystemPtr(), tc->contextId(), st, getFrame(tc), true, args[0]);
|
||||
}
|
||||
|
||||
@@ -688,10 +688,10 @@ CPA::swAq(ThreadContext *tc)
|
||||
|
||||
warn("%d: Queue Assert: SW said there should be %d byte(s) in %s,"
|
||||
"however there are %d byte(s)\n",
|
||||
curTick, size, q, qBytes[qi-1]);
|
||||
curTick(), size, q, qBytes[qi-1]);
|
||||
DPRINTF(AnnotateQ, "%d: Queue Assert: SW said there should be %d"
|
||||
" byte(s) in %s, however there are %d byte(s)\n",
|
||||
curTick, size, q, qBytes[qi-1]);
|
||||
curTick(), size, q, qBytes[qi-1]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -813,7 +813,7 @@ CPA::AnnDataPtr
|
||||
CPA::add(int t, int f, int c, int sm, int stq, int32_t d)
|
||||
{
|
||||
AnnDataPtr an = new AnnotateData;
|
||||
an->time = curTick;
|
||||
an->time = curTick();
|
||||
an->data = d;
|
||||
an->orig_data = d;
|
||||
an->op = t;
|
||||
|
||||
@@ -408,7 +408,7 @@ class CPA : SimObject
|
||||
int smi = getSm(sysi, sm, frame);
|
||||
add(OP_BEGIN, FL_HW | f, 0, smi, getSt(sm, st));
|
||||
if (f & FL_BAD)
|
||||
warn("BAD state encountered: at cycle %d: %s\n", curTick, st);
|
||||
warn("BAD state encountered: at cycle %d: %s\n", curTick(), st);
|
||||
}
|
||||
|
||||
inline void hwQ(flags f, System *sys, uint64_t frame, std::string sm,
|
||||
|
||||
@@ -80,7 +80,7 @@ FastAlloc::moreStructs(int bucket)
|
||||
#include <typeinfo>
|
||||
|
||||
#include "base/cprintf.hh"
|
||||
#include "sim/core.hh" // for curTick
|
||||
#include "sim/core.hh" // for curTick()
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -104,7 +104,7 @@ FastAlloc::FastAlloc()
|
||||
{
|
||||
// mark this object in use
|
||||
inUse = true;
|
||||
whenAllocated = curTick;
|
||||
whenAllocated = curTick();
|
||||
|
||||
// update count
|
||||
++numInUse;
|
||||
|
||||
@@ -76,7 +76,7 @@ __exit_message(const char *prefix, int code,
|
||||
format += "Memory Usage: %ld KBytes\n";
|
||||
format += "For more information see: http://www.m5sim.org/%s/%x\n";
|
||||
|
||||
args.push_back(curTick);
|
||||
args.push_back(curTick());
|
||||
args.push_back(func);
|
||||
args.push_back(file);
|
||||
args.push_back(line);
|
||||
@@ -114,7 +114,7 @@ __base_message(std::ostream &stream, const char *prefix, bool verbose,
|
||||
|
||||
if (verbose) {
|
||||
format += " @ cycle %d\n[%s:%s, line %d]\n";
|
||||
args.push_back(curTick);
|
||||
args.push_back(curTick());
|
||||
args.push_back(func);
|
||||
args.push_back(file);
|
||||
args.push_back(line);
|
||||
|
||||
@@ -217,10 +217,10 @@ GDBListener::listen()
|
||||
|
||||
#ifndef NDEBUG
|
||||
ccprintf(cerr, "%d: %s: listening for remote gdb #%d on port %d\n",
|
||||
curTick, name(), gdb->number, port);
|
||||
curTick(), name(), gdb->number, port);
|
||||
#else
|
||||
ccprintf(cerr, "%d: %s: listening for remote gdb on port %d\n",
|
||||
curTick, name(), port);
|
||||
curTick(), name(), port);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
class Callback;
|
||||
|
||||
/** The current simulated tick. */
|
||||
extern Tick curTick;
|
||||
extern Tick curTick();
|
||||
|
||||
/* A namespace for all of the Statistics */
|
||||
namespace Stats {
|
||||
@@ -530,8 +530,8 @@ class AvgStor
|
||||
void
|
||||
set(Counter val)
|
||||
{
|
||||
total += current * (curTick - last);
|
||||
last = curTick;
|
||||
total += current * (curTick() - last);
|
||||
last = curTick();
|
||||
current = val;
|
||||
}
|
||||
|
||||
@@ -560,8 +560,8 @@ class AvgStor
|
||||
Result
|
||||
result() const
|
||||
{
|
||||
assert(last == curTick);
|
||||
return (Result)(total + current) / (Result)(curTick - lastReset + 1);
|
||||
assert(last == curTick());
|
||||
return (Result)(total + current) / (Result)(curTick() - lastReset + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -575,8 +575,8 @@ class AvgStor
|
||||
void
|
||||
prepare(Info *info)
|
||||
{
|
||||
total += current * (curTick - last);
|
||||
last = curTick;
|
||||
total += current * (curTick() - last);
|
||||
last = curTick();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -586,8 +586,8 @@ class AvgStor
|
||||
reset(Info *info)
|
||||
{
|
||||
total = 0.0;
|
||||
last = curTick;
|
||||
lastReset = curTick;
|
||||
last = curTick();
|
||||
lastReset = curTick();
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1576,7 +1576,7 @@ class AvgSampleStor
|
||||
data.type = params->type;
|
||||
data.sum = sum;
|
||||
data.squares = squares;
|
||||
data.samples = curTick;
|
||||
data.samples = curTick();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -613,7 +613,7 @@ MySql::output()
|
||||
configure();
|
||||
|
||||
// store sample #
|
||||
newdata.tick = curTick;
|
||||
newdata.tick = curTick();
|
||||
|
||||
MySQL::Connection &mysql = run->conn();
|
||||
|
||||
|
||||
@@ -45,10 +45,10 @@ list<Output *> OutputList;
|
||||
void
|
||||
dump()
|
||||
{
|
||||
assert(lastDump <= curTick);
|
||||
if (lastDump == curTick)
|
||||
assert(lastDump <= curTick());
|
||||
if (lastDump == curTick())
|
||||
return;
|
||||
lastDump = curTick;
|
||||
lastDump = curTick();
|
||||
|
||||
prepare();
|
||||
|
||||
|
||||
@@ -89,17 +89,17 @@ inline const std::string &name() { return Trace::DefaultName; }
|
||||
|
||||
#define DDUMP(x, data, count) do { \
|
||||
if (DTRACE(x)) \
|
||||
Trace::dump(curTick, name(), data, count); \
|
||||
Trace::dump(curTick(), name(), data, count); \
|
||||
} while (0)
|
||||
|
||||
#define DPRINTF(x, ...) do { \
|
||||
if (DTRACE(x)) \
|
||||
Trace::dprintf(curTick, name(), __VA_ARGS__); \
|
||||
Trace::dprintf(curTick(), name(), __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define DPRINTFS(x,s, ...) do { \
|
||||
if (DTRACE(x)) \
|
||||
Trace::dprintf(curTick, s->name(), __VA_ARGS__); \
|
||||
Trace::dprintf(curTick(), s->name(), __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
|
||||
@@ -109,11 +109,11 @@ inline const std::string &name() { return Trace::DefaultName; }
|
||||
} while (0)
|
||||
|
||||
#define DDUMPN(data, count) do { \
|
||||
Trace::dump(curTick, name(), data, count); \
|
||||
Trace::dump(curTick(), name(), data, count); \
|
||||
} while (0)
|
||||
|
||||
#define DPRINTFN(...) do { \
|
||||
Trace::dprintf(curTick, name(), __VA_ARGS__); \
|
||||
Trace::dprintf(curTick(), name(), __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define DPRINTFNR(...) do { \
|
||||
|
||||
Reference in New Issue
Block a user