checksum-oostubs adapted to ProtoStream (NOT TESTED)
git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1303 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
@ -6,6 +6,7 @@
|
|||||||
#include "experimentInfo.hpp"
|
#include "experimentInfo.hpp"
|
||||||
#include "controller/CampaignManager.hpp"
|
#include "controller/CampaignManager.hpp"
|
||||||
#include "util/Logger.hpp"
|
#include "util/Logger.hpp"
|
||||||
|
#include "util/ProtoStream.hpp"
|
||||||
#include "util/MemoryMap.hpp"
|
#include "util/MemoryMap.hpp"
|
||||||
|
|
||||||
#include "ecc_region.hpp"
|
#include "ecc_region.hpp"
|
||||||
@ -46,16 +47,12 @@ bool ChecksumOOStuBSCampaign::run()
|
|||||||
log << "startup" << endl;
|
log << "startup" << endl;
|
||||||
|
|
||||||
// load trace
|
// load trace
|
||||||
log << "loading trace ..." << endl;
|
|
||||||
ifstream tracef(trace_filename);
|
ifstream tracef(trace_filename);
|
||||||
if (tracef.fail()) {
|
if (tracef.fail()) {
|
||||||
log << "couldn't open " << trace_filename << endl;
|
log << "couldn't open " << trace_filename << endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Trace trace;
|
ProtoIStream ps(&tracef);
|
||||||
trace.ParseFromIstream(&tracef);
|
|
||||||
tracef.close();
|
|
||||||
log << "... done." << endl;
|
|
||||||
|
|
||||||
// a map of addresses of ECC protected objects
|
// a map of addresses of ECC protected objects
|
||||||
MemoryMap mm;
|
MemoryMap mm;
|
||||||
@ -85,23 +82,22 @@ bool ChecksumOOStuBSCampaign::run()
|
|||||||
current_ec.instr1 = 0;
|
current_ec.instr1 = 0;
|
||||||
int instr = 0;
|
int instr = 0;
|
||||||
sal::address_t instr_absolute = 0; // FIXME this one probably should also be recorded ...
|
sal::address_t instr_absolute = 0; // FIXME this one probably should also be recorded ...
|
||||||
Trace_Event const *ev;
|
Trace_Event ev;
|
||||||
|
ps.reset();
|
||||||
|
|
||||||
// for every section in the trace between subsequent memory
|
// for every section in the trace between subsequent memory
|
||||||
// accesses to that address ...
|
// accesses to that address ...
|
||||||
// XXX reorganizing the trace for efficient seeks could speed this up
|
// XXX reorganizing the trace for efficient seeks could speed this up
|
||||||
for (int eventnr = 0; eventnr < trace.event_size(); ++eventnr) {
|
while(ps.getNext(&ev)) {
|
||||||
ev = &trace.event(eventnr);
|
|
||||||
|
|
||||||
// instruction events just get counted
|
// instruction events just get counted
|
||||||
if (!ev->has_memaddr()) {
|
if (!ev.has_memaddr()) {
|
||||||
// new instruction
|
// new instruction
|
||||||
instr++;
|
instr++;
|
||||||
instr_absolute = ev->ip();
|
instr_absolute = ev.ip();
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// skip accesses to other data
|
// skip accesses to other data
|
||||||
} else if (ev->memaddr() != data_address) {
|
} else if (ev.memaddr() != data_address) {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// skip zero-sized intervals: these can
|
// skip zero-sized intervals: these can
|
||||||
@ -121,7 +117,7 @@ bool ChecksumOOStuBSCampaign::run()
|
|||||||
current_ec.instr2_absolute = instr_absolute;
|
current_ec.instr2_absolute = instr_absolute;
|
||||||
current_ec.data_address = data_address;
|
current_ec.data_address = data_address;
|
||||||
|
|
||||||
if (ev->accesstype() == ev->READ) {
|
if (ev.accesstype() == ev.READ) {
|
||||||
// a sequence ending with READ: we need
|
// a sequence ending with READ: we need
|
||||||
// to do one experiment to cover it
|
// to do one experiment to cover it
|
||||||
// completely
|
// completely
|
||||||
@ -143,7 +139,7 @@ bool ChecksumOOStuBSCampaign::run()
|
|||||||
fi::campaignmanager.addParam(d);
|
fi::campaignmanager.addParam(d);
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
} else if (ev->accesstype() == ev->WRITE) {
|
} else if (ev.accesstype() == ev.WRITE) {
|
||||||
// a sequence ending with WRITE: an
|
// a sequence ending with WRITE: an
|
||||||
// injection anywhere here would have
|
// injection anywhere here would have
|
||||||
// no effect.
|
// no effect.
|
||||||
|
|||||||
@ -66,8 +66,8 @@ bool ChecksumOOStuBSExperiment::run()
|
|||||||
tp.restrictMemoryAddresses(&mm);
|
tp.restrictMemoryAddresses(&mm);
|
||||||
|
|
||||||
// record trace
|
// record trace
|
||||||
Trace trace;
|
std::ofstream of("trace.pb");
|
||||||
tp.setTraceMessage(&trace);
|
tp.setTraceFile(&of);
|
||||||
|
|
||||||
// this must be done *after* configuring the plugin:
|
// this must be done *after* configuring the plugin:
|
||||||
sal::simulator.addFlow(&tp);
|
sal::simulator.addFlow(&tp);
|
||||||
@ -94,14 +94,11 @@ bool ChecksumOOStuBSExperiment::run()
|
|||||||
sal::simulator.removeFlow(&tp);
|
sal::simulator.removeFlow(&tp);
|
||||||
|
|
||||||
// serialize trace to file
|
// serialize trace to file
|
||||||
char const *tracefile = "trace.pb";
|
|
||||||
std::ofstream of(tracefile);
|
|
||||||
if (of.fail()) {
|
if (of.fail()) {
|
||||||
log << "failed to write " << tracefile << endl;
|
log << "failed to write " << tracefile << endl;
|
||||||
sal::simulator.clearEvents(this);
|
sal::simulator.clearEvents(this);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
trace.SerializeToOstream(&of);
|
|
||||||
of.close();
|
of.close();
|
||||||
log << "trace written to " << tracefile << endl;
|
log << "trace written to " << tracefile << endl;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user