coolchecksum adapted to ProtoStream
git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1282 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
#include "experimentInfo.hpp"
|
||||
#include "controller/CampaignManager.hpp"
|
||||
#include "util/Logger.hpp"
|
||||
#include "util/ProtoStream.hpp"
|
||||
#include "SAL/SALConfig.hpp"
|
||||
|
||||
#if COOL_FAULTSPACE_PRUNING
|
||||
@ -82,9 +83,7 @@ bool CoolChecksumCampaign::run()
|
||||
log << "couldn't open " << trace_filename << endl;
|
||||
return false;
|
||||
}
|
||||
Trace trace;
|
||||
trace.ParseFromIstream(&tracef);
|
||||
tracef.close();
|
||||
ProtoIStream ps(&tracef);
|
||||
|
||||
// set of equivalence classes that need one (rather: eight, one for
|
||||
// each bit in that byte) experiment to determine them all
|
||||
@ -105,19 +104,19 @@ bool CoolChecksumCampaign::run()
|
||||
// XXX reorganizing the trace for efficient seeks could speed this up
|
||||
int instr = 0;
|
||||
sal::address_t instr_absolute = 0; // FIXME this one probably should also be recorded ...
|
||||
Trace_Event const *ev;
|
||||
for (int eventnr = 0; eventnr < trace.event_size(); ++eventnr) {
|
||||
ev = &trace.event(eventnr);
|
||||
|
||||
Trace_Event ev;
|
||||
ps.reset();
|
||||
|
||||
while(ps.getNext(&ev)) {
|
||||
// only count instruction events
|
||||
if (!ev->has_memaddr()) {
|
||||
if (!ev.has_memaddr()) {
|
||||
// new instruction
|
||||
instr++;
|
||||
instr_absolute = ev->ip();
|
||||
instr_absolute = ev.ip();
|
||||
continue;
|
||||
|
||||
// skip accesses to other data
|
||||
} else if (ev->memaddr() != byte_offset + COOL_ECC_OBJUNDERTEST) {
|
||||
} else if (ev.memaddr() != byte_offset + COOL_ECC_OBJUNDERTEST) {
|
||||
continue;
|
||||
|
||||
// skip zero-sized intervals: these can
|
||||
@ -137,12 +136,12 @@ bool CoolChecksumCampaign::run()
|
||||
current_ec.instr2_absolute = instr_absolute;
|
||||
current_ec.byte_offset = byte_offset;
|
||||
|
||||
if (ev->accesstype() == ev->READ) {
|
||||
if (ev.accesstype() == ev.READ) {
|
||||
// a sequence ending with READ: we need
|
||||
// to do one experiment to cover it
|
||||
// completely
|
||||
ecs_need_experiment.push_back(current_ec);
|
||||
} else if (ev->accesstype() == ev->WRITE) {
|
||||
} else if (ev.accesstype() == ev.WRITE) {
|
||||
// a sequence ending with WRITE: an
|
||||
// injection anywhere here would have
|
||||
// no effect.
|
||||
|
||||
@ -62,8 +62,8 @@ bool CoolChecksumExperiment::run()
|
||||
tp.restrictMemoryAddresses(&mm);
|
||||
|
||||
// record trace
|
||||
Trace trace;
|
||||
tp.setTraceMessage(&trace);
|
||||
std::ofstream of("trace.pb");
|
||||
tp.setTraceFile(&of);
|
||||
|
||||
// this must be done *after* configuring the plugin:
|
||||
sal::simulator.addFlow(&tp);
|
||||
@ -86,13 +86,11 @@ bool CoolChecksumExperiment::run()
|
||||
sal::simulator.removeFlow(&tp);
|
||||
|
||||
// serialize trace to file
|
||||
std::ofstream of("trace.pb");
|
||||
if (of.fail()) {
|
||||
log << "failed to write trace.pb" << endl;
|
||||
sal::simulator.clearEvents(this);
|
||||
return false;
|
||||
}
|
||||
trace.SerializeToOstream(&of);
|
||||
of.close();
|
||||
#endif
|
||||
|
||||
|
||||
@ -22,7 +22,10 @@ bool TracingPlugin::run()
|
||||
if (m_memonly || !m_iponly) {
|
||||
simulator.addEvent(&ev_mem);
|
||||
}
|
||||
|
||||
if(m_protoStreamFile) {
|
||||
ps = new ProtoOStream(m_protoStreamFile);
|
||||
}
|
||||
|
||||
while (true) {
|
||||
ev = simulator.waitAny();
|
||||
|
||||
@ -36,9 +39,10 @@ bool TracingPlugin::run()
|
||||
|
||||
if (m_os)
|
||||
*m_os << "[Tracing] IP " << hex << ip << "\n";
|
||||
if (m_trace) {
|
||||
Trace_Event *e = m_trace->add_event();
|
||||
e->set_ip(ip);
|
||||
if (m_protoStreamFile) {
|
||||
Trace_Event e;
|
||||
e.set_ip(ip);
|
||||
ps->writeMessage(&e);
|
||||
}
|
||||
} else if (ev == &ev_mem) {
|
||||
simulator.addEvent(&ev_mem);
|
||||
@ -56,14 +60,15 @@ bool TracingPlugin::run()
|
||||
<< ((ev_mem.getTriggerAccessType() &
|
||||
MemAccessEvent::MEM_READ) ? "R " : "W ")
|
||||
<< addr << " width " << width << " IP " << ip << "\n";
|
||||
if (m_trace) {
|
||||
Trace_Event *e = m_trace->add_event();
|
||||
e->set_ip(ip);
|
||||
e->set_memaddr(addr);
|
||||
e->set_width(width);
|
||||
e->set_accesstype(
|
||||
if (m_protoStreamFile) {
|
||||
Trace_Event e;
|
||||
e.set_ip(ip);
|
||||
e.set_memaddr(addr);
|
||||
e.set_width(width);
|
||||
e.set_accesstype(
|
||||
(ev_mem.getTriggerAccessType() & MemAccessEvent::MEM_READ) ?
|
||||
e->READ : e->WRITE);
|
||||
e.READ : e.WRITE);
|
||||
ps->writeMessage(&e);
|
||||
}
|
||||
} else {
|
||||
if (m_os)
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include <ostream>
|
||||
#include "controller/ExperimentFlow.hpp"
|
||||
#include "util/MemoryMap.hpp"
|
||||
#include "util/ProtoStream.hpp"
|
||||
#include "config/FailConfig.hpp"
|
||||
|
||||
#include "plugins/tracing/trace.pb.h"
|
||||
@ -41,13 +42,14 @@ private:
|
||||
bool m_memonly; //!< log instructions only if they are memory accesses
|
||||
bool m_iponly; //!< log instruction addresses only
|
||||
|
||||
Trace *m_trace; //!< protobuf message to store trace in
|
||||
std::ostream *m_protoStreamFile;
|
||||
std::ostream *m_os; //!< ostream to write human-readable trace into
|
||||
ProtoOStream *ps;
|
||||
|
||||
public:
|
||||
TracingPlugin()
|
||||
: m_memMap(0), m_ipMap(0), m_memonly(false), m_iponly(false),
|
||||
m_trace(0), m_os(0) { }
|
||||
m_protoStreamFile(0), m_os(0) { }
|
||||
bool run();
|
||||
/**
|
||||
* Restricts tracing to memory addresses listed in this MemoryMap. An
|
||||
@ -77,9 +79,9 @@ public:
|
||||
*/
|
||||
void setOstream(std::ostream *os) { m_os = os; }
|
||||
/**
|
||||
* Protobuf message to trace into (trace.proto instance)
|
||||
* ProtoStream file to trace into (trace.proto instance)
|
||||
*/
|
||||
void setTraceMessage(Trace *trace) { m_trace = trace; }
|
||||
void setTraceFile(std::ostream *os) { m_protoStreamFile = os; }
|
||||
};
|
||||
|
||||
#endif /* __TRACING_PLUGIN_HPP__ */
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
message Trace {
|
||||
repeated group Event = 1{
|
||||
required uint64 ip = 1;
|
||||
message Trace_Event {
|
||||
required uint64 ip = 1;
|
||||
optional uint64 memaddr = 2;
|
||||
optional uint32 width = 3;
|
||||
enum AccessType {
|
||||
@ -8,5 +7,4 @@ message Trace {
|
||||
WRITE = 2;
|
||||
}
|
||||
optional AccessType accesstype = 4;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ set(SRCS
|
||||
SynchronizedCounter.cc
|
||||
Logger.hpp
|
||||
Logger.cc
|
||||
ProtoStream.cc
|
||||
)
|
||||
|
||||
add_library(util ${SRCS})
|
||||
|
||||
Reference in New Issue
Block a user