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:
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user