summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorSteve Reinhardt <steve.reinhardt@amd.com>2011-01-07 21:50:29 -0800
committerSteve Reinhardt <steve.reinhardt@amd.com>2011-01-07 21:50:29 -0800
commit6f1187943cf78c2fd0334bd7e4372ae79a587fa4 (patch)
tree8d0eac2e2f4d55d48245266d3930ad4e7f92030f /src/base
parentc22be9f2f016872b05d65c82055ddc936b4aa075 (diff)
downloadgem5-6f1187943cf78c2fd0334bd7e4372ae79a587fa4.tar.xz
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.
Diffstat (limited to 'src/base')
-rw-r--r--src/base/cp_annotate.cc12
-rw-r--r--src/base/cp_annotate.hh2
-rw-r--r--src/base/fast_alloc.cc4
-rw-r--r--src/base/misc.cc4
-rw-r--r--src/base/remote_gdb.cc4
-rw-r--r--src/base/statistics.hh20
-rw-r--r--src/base/stats/mysql.cc2
-rw-r--r--src/base/stats/output.cc6
-rw-r--r--src/base/trace.hh10
9 files changed, 32 insertions, 32 deletions
diff --git a/src/base/cp_annotate.cc b/src/base/cp_annotate.cc
index 4e138a6dd..69b926b29 100644
--- a/src/base/cp_annotate.cc
+++ b/src/base/cp_annotate.cc
@@ -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;
diff --git a/src/base/cp_annotate.hh b/src/base/cp_annotate.hh
index 8ce9995a8..fb955a380 100644
--- a/src/base/cp_annotate.hh
+++ b/src/base/cp_annotate.hh
@@ -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,
diff --git a/src/base/fast_alloc.cc b/src/base/fast_alloc.cc
index 0238f03cb..649f94be3 100644
--- a/src/base/fast_alloc.cc
+++ b/src/base/fast_alloc.cc
@@ -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;
diff --git a/src/base/misc.cc b/src/base/misc.cc
index 65cb13356..94336c647 100644
--- a/src/base/misc.cc
+++ b/src/base/misc.cc
@@ -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);
diff --git a/src/base/remote_gdb.cc b/src/base/remote_gdb.cc
index b7c34859b..abc5f4ec0 100644
--- a/src/base/remote_gdb.cc
+++ b/src/base/remote_gdb.cc
@@ -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
}
diff --git a/src/base/statistics.hh b/src/base/statistics.hh
index 3bb74282a..9c10164a9 100644
--- a/src/base/statistics.hh
+++ b/src/base/statistics.hh
@@ -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();
}
/**
diff --git a/src/base/stats/mysql.cc b/src/base/stats/mysql.cc
index d947122da..d257de743 100644
--- a/src/base/stats/mysql.cc
+++ b/src/base/stats/mysql.cc
@@ -613,7 +613,7 @@ MySql::output()
configure();
// store sample #
- newdata.tick = curTick;
+ newdata.tick = curTick();
MySQL::Connection &mysql = run->conn();
diff --git a/src/base/stats/output.cc b/src/base/stats/output.cc
index 9d110e4ee..d3cb9da61 100644
--- a/src/base/stats/output.cc
+++ b/src/base/stats/output.cc
@@ -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();
diff --git a/src/base/trace.hh b/src/base/trace.hh
index f793abff9..a03a34018 100644
--- a/src/base/trace.hh
+++ b/src/base/trace.hh
@@ -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 { \