Revert "generic-tracing: fix lossage of first event"

This reverts commit 036e340bd9.

Problems with this one were:
 -  Broken event timings.  m_prevtime wasn't reset to m_curtime in
    TracingPlugin::handleSingleIP(), resulting in a large deltatime
    being recorded for the second event, too.  This effectively
    doubled the experiment's start time.
 -  Code repetition (copy/pasted for special handling of first event),
    making planned changes (advanced tracing for IP events) more
    difficult.
 -  Unnecessary additional tracing-plugin interface method.

Change-Id: I4b74d1a3f4563aabe6626399f9b30a2171b4c285
This commit is contained in:
Horst Schirmeier
2013-10-15 13:00:32 +02:00
parent 036e340bd9
commit 090125a283
3 changed files with 5 additions and 50 deletions

View File

@ -1,7 +1,6 @@
#include <iostream>
#include <assert.h>
#include "sal/SALConfig.hpp"
#include "sal/SALInst.hpp"
#include "sal/Register.hpp"
#include "sal/Memory.hpp"
@ -11,34 +10,6 @@
using namespace std;
using namespace fail;
void TracingPlugin::handleSingleIP(const BPListener &bp) {
address_t ip = bp.getTriggerInstructionPointer();
if (m_ipMap && !m_ipMap->isMatching(ip)) {
return;
}
m_curtime = simulator.getTimerTicks();
simtime_diff_t deltatime = m_curtime - m_prevtime;
if (m_os)
*m_os << "[Tracing] IP " << hex << ip << "\n";
if (m_protoStreamFile) {
Trace_Event e;
e.set_ip(ip);
// only store deltas != 0
if (deltatime != 0) {
e.set_time_delta(deltatime);
}
if (!ps) {
ps = new ProtoOStream (m_protoStreamFile);
}
ps->writeMessage(&e);
}
}
bool TracingPlugin::run()
{
MemoryManager& mm = simulator.getMemoryManager();
@ -62,13 +33,14 @@ bool TracingPlugin::run()
// the first event gets an absolute time stamp, all others a delta to their
// predecessor
simtime_t prevtime = 0, curtime;
simtime_diff_t deltatime;
while (true) {
ev = simulator.resume();
m_curtime = simulator.getTimerTicks();
deltatime = m_curtime - m_prevtime;
curtime = simulator.getTimerTicks();
deltatime = curtime - prevtime;
if (ev == &ev_step) {
simulator.addListener(&ev_step);
@ -150,7 +122,7 @@ bool TracingPlugin::run()
// do this only if the last delta was written
// (no, e.g., memory map mismatch)
m_prevtime = m_curtime;
prevtime = curtime;
}
return true;