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:
@ -209,10 +209,6 @@ bool GenericTracing::run()
|
|||||||
// this must be done *after* configuring the plugin:
|
// this must be done *after* configuring the plugin:
|
||||||
simulator.addFlow(&tp);
|
simulator.addFlow(&tp);
|
||||||
|
|
||||||
// In order to not loose the IP event at the beginning of the
|
|
||||||
// trace, we have to handle the IP event manually
|
|
||||||
tp.handleSingleIP(l_start_symbol);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
// STEP 2: continue to the save point, and save state
|
// STEP 2: continue to the save point, and save state
|
||||||
if (start_symbol != save_symbol) {
|
if (start_symbol != save_symbol) {
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "sal/SALConfig.hpp"
|
|
||||||
#include "sal/SALInst.hpp"
|
#include "sal/SALInst.hpp"
|
||||||
#include "sal/Register.hpp"
|
#include "sal/Register.hpp"
|
||||||
#include "sal/Memory.hpp"
|
#include "sal/Memory.hpp"
|
||||||
@ -11,34 +10,6 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace fail;
|
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()
|
bool TracingPlugin::run()
|
||||||
{
|
{
|
||||||
MemoryManager& mm = simulator.getMemoryManager();
|
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
|
// the first event gets an absolute time stamp, all others a delta to their
|
||||||
// predecessor
|
// predecessor
|
||||||
|
simtime_t prevtime = 0, curtime;
|
||||||
simtime_diff_t deltatime;
|
simtime_diff_t deltatime;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
ev = simulator.resume();
|
ev = simulator.resume();
|
||||||
|
|
||||||
m_curtime = simulator.getTimerTicks();
|
curtime = simulator.getTimerTicks();
|
||||||
deltatime = m_curtime - m_prevtime;
|
deltatime = curtime - prevtime;
|
||||||
|
|
||||||
if (ev == &ev_step) {
|
if (ev == &ev_step) {
|
||||||
simulator.addListener(&ev_step);
|
simulator.addListener(&ev_step);
|
||||||
@ -150,7 +122,7 @@ bool TracingPlugin::run()
|
|||||||
|
|
||||||
// do this only if the last delta was written
|
// do this only if the last delta was written
|
||||||
// (no, e.g., memory map mismatch)
|
// (no, e.g., memory map mismatch)
|
||||||
m_prevtime = m_curtime;
|
prevtime = curtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -7,8 +7,6 @@
|
|||||||
#include "util/ProtoStream.hpp"
|
#include "util/ProtoStream.hpp"
|
||||||
#include "efw/ExperimentFlow.hpp"
|
#include "efw/ExperimentFlow.hpp"
|
||||||
#include "config/FailConfig.hpp"
|
#include "config/FailConfig.hpp"
|
||||||
#include "sal/Listener.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
#include "TracePlugin.pb.h"
|
#include "TracePlugin.pb.h"
|
||||||
|
|
||||||
@ -50,14 +48,10 @@ private:
|
|||||||
std::ostream *m_os; //!< ostream to write human-readable trace into
|
std::ostream *m_os; //!< ostream to write human-readable trace into
|
||||||
fail::ProtoOStream *ps;
|
fail::ProtoOStream *ps;
|
||||||
|
|
||||||
fail::simtime_t m_prevtime;
|
|
||||||
fail::simtime_t m_curtime;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TracingPlugin(bool full_trace = false)
|
TracingPlugin(bool full_trace = false)
|
||||||
: m_memMap(0), m_ipMap(0), m_memonly(false), m_iponly(false),
|
: m_memMap(0), m_ipMap(0), m_memonly(false), m_iponly(false),
|
||||||
m_full_trace(full_trace), m_protoStreamFile(0), m_os(0),
|
m_full_trace(full_trace), m_protoStreamFile(0), m_os(0) { }
|
||||||
m_prevtime(0) { }
|
|
||||||
bool run();
|
bool run();
|
||||||
/**
|
/**
|
||||||
* Restricts tracing to memory addresses listed in this MemoryMap. An
|
* Restricts tracing to memory addresses listed in this MemoryMap. An
|
||||||
@ -94,13 +88,6 @@ public:
|
|||||||
* ProtoStream file to trace into (trace.proto instance)
|
* ProtoStream file to trace into (trace.proto instance)
|
||||||
*/
|
*/
|
||||||
void setTraceFile(std::ostream *os) { m_protoStreamFile = os; }
|
void setTraceFile(std::ostream *os) { m_protoStreamFile = os; }
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles a single IP event. This is important for starting the
|
|
||||||
* tracing process after triggering a breakpoint. Just pass on the
|
|
||||||
* breakpoint
|
|
||||||
*/
|
|
||||||
void handleSingleIP(const fail::BPListener &bp);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __TRACING_PLUGIN_HPP__
|
#endif // __TRACING_PLUGIN_HPP__
|
||||||
|
|||||||
Reference in New Issue
Block a user