From 64034e29b4bf4f047706d69064dcde26ea790f9b Mon Sep 17 00:00:00 2001 From: Horst Schirmeier Date: Thu, 17 Oct 2013 19:07:08 +0200 Subject: [PATCH] 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 --- src/plugins/tracing/TracingPlugin.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/plugins/tracing/TracingPlugin.cc b/src/plugins/tracing/TracingPlugin.cc index ff0dae1c..7dbb4f0e 100644 --- a/src/plugins/tracing/TracingPlugin.cc +++ b/src/plugins/tracing/TracingPlugin.cc @@ -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(); }