summaryrefslogtreecommitdiff
path: root/util/statetrace
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2009-07-27 00:54:30 -0700
committerGabe Black <gblack@eecs.umich.edu>2009-07-27 00:54:30 -0700
commit52b4a7c36ffbfcf48f6360ace5b69c18adddfa7a (patch)
tree424eaa26a4d69bef98a0825655f5ce516e3c3d8b /util/statetrace
parent90d3d3535b206fa011ab86ffc278c8851fe997a6 (diff)
downloadgem5-52b4a7c36ffbfcf48f6360ace5b69c18adddfa7a.tar.xz
ARM: Only send information that changed between statetrace and M5.
Diffstat (limited to 'util/statetrace')
-rw-r--r--util/statetrace/arch/tracechild_arm.cc29
-rw-r--r--util/statetrace/tracechild.cc5
2 files changed, 22 insertions, 12 deletions
diff --git a/util/statetrace/arch/tracechild_arm.cc b/util/statetrace/arch/tracechild_arm.cc
index fc2eb3e24..4687b46f0 100644
--- a/util/statetrace/arch/tracechild_arm.cc
+++ b/util/statetrace/arch/tracechild_arm.cc
@@ -46,23 +46,38 @@ const char* ARMTraceChild::regNames[numregs] = {
ARMTraceChild::ARMTraceChild()
{
- for (int x = 0; x < numregs; x++)
+ for (int x = 0; x < numregs; x++) {
+ memset(&regs, 0, sizeof(regs));
+ memset(&oldregs, 0, sizeof(regs));
regDiffSinceUpdate[x] = false;
+ }
}
bool ARMTraceChild::sendState(int socket)
{
uint32_t regVal = 0;
- for(int x = 0; x < numregs; x++)
- {
- regVal = getRegVal(x);
- if(write(socket, &regVal, sizeof(regVal)) == -1)
- {
+ uint32_t message[numregs + 1];
+ int pos = 1;
+ message[0] = 0;
+ for (int x = 0; x < numregs; x++) {
+ if (regDiffSinceUpdate[x]) {
+ message[0] = message[0] | (1 << x);
+ message[pos++] = getRegVal(x);
+ }
+ }
+
+ size_t sent = 0;
+ size_t toSend = pos * sizeof(message[0]);
+ uint8_t *messagePtr = (uint8_t *)message;
+ while (toSend != 0) {
+ sent = write(socket, messagePtr, toSend);
+ if (sent == -1) {
cerr << "Write failed! " << strerror(errno) << endl;
tracing = false;
return false;
}
-
+ toSend -= sent;
+ messagePtr += sent;
}
return true;
diff --git a/util/statetrace/tracechild.cc b/util/statetrace/tracechild.cc
index 52e19a0e9..85f42addd 100644
--- a/util/statetrace/tracechild.cc
+++ b/util/statetrace/tracechild.cc
@@ -79,11 +79,6 @@ bool TraceChild::startTracing(const char * pathToFile, char * const argv[])
return false;
}
tracing = true;
- if(!update(pid))
- {
- cout << "Didn't update successfully!" << endl;
- return false;
- }
return true;
}