tracing: bugfix: advance prevtime only if delta was recorded

This change implements what the source-code comment already promised but
didn't keep: As we only record time deltas instead of absolute time values,
prevtime must not be overwritten unless the current delta was really added
to the trace.  This has caused timing information to be stored incorrectly
if certain events were skipped (e.g., because they didn't match the memory
map configured by the user).

Change-Id: Id40271d117dd91b1122136c62329d64174f304b0
This commit is contained in:
Horst Schirmeier
2013-10-17 19:07:08 +02:00
parent 22b9646b80
commit 64034e29b4

View File

@ -58,6 +58,10 @@ bool TracingPlugin::run()
// only store deltas != 0
if (deltatime != 0) {
e.set_time_delta(deltatime);
// do this only if the last delta was written
// (no, e.g., memory map mismatch)
prevtime = curtime;
}
ps->writeMessage(&e);
}
@ -88,6 +92,10 @@ bool TracingPlugin::run()
// only store deltas != 0
if (deltatime != 0) {
e.set_time_delta(deltatime);
// do this only if the last delta was written
// (no, e.g., memory map mismatch)
prevtime = curtime;
}
/* When we're doing a full trace, we log more data in
@ -120,10 +128,6 @@ bool TracingPlugin::run()
*m_os << "[Tracing] SOMETHING IS SERIOUSLY WRONG\n";
}
// do this only if the last delta was written
// (no, e.g., memory map mismatch)
prevtime = curtime;
ev = simulator.resume();
}