Fail* directories reorganized, Code-cleanup (-> coding-style), Typos+comments fixed.
git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1321 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
17
src/experiments/tracing-test/CMakeLists.txt
Normal file
17
src/experiments/tracing-test/CMakeLists.txt
Normal file
@ -0,0 +1,17 @@
|
||||
set(EXPERIMENT_NAME tracing-test)
|
||||
set(EXPERIMENT_TYPE TracingTest)
|
||||
configure_file(../instantiate-experiment.ah.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/instantiate-${EXPERIMENT_NAME}.ah @ONLY
|
||||
)
|
||||
|
||||
set(MY_CAMPAIGN_SRCS
|
||||
experiment.hpp
|
||||
experiment.cc
|
||||
)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
## Build library
|
||||
add_library(${EXPERIMENT_NAME} ${PROTO_SRCS} ${PROTO_HDRS} ${MY_CAMPAIGN_SRCS})
|
||||
|
||||
add_dependencies(${EXPERIMENT_NAME} tracing)
|
||||
78
src/experiments/tracing-test/experiment.cc
Normal file
78
src/experiments/tracing-test/experiment.cc
Normal file
@ -0,0 +1,78 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include "sal/SALInst.hpp"
|
||||
#include "sal/Register.hpp"
|
||||
#include "experiment.hpp"
|
||||
#include "../plugins/tracing/TracingPlugin.hpp"
|
||||
|
||||
/*
|
||||
#include <google/protobuf/io/zero_copy_stream_impl.h>
|
||||
#include <google/protobuf/io/gzip_stream.h>
|
||||
*/
|
||||
|
||||
using namespace std;
|
||||
using namespace fail;
|
||||
|
||||
bool TracingTest::run()
|
||||
{
|
||||
cout << "[TracingTest] Setting up experiment" << endl;
|
||||
|
||||
#if 0
|
||||
// STEP 1: run until interesting function starts, and save state
|
||||
BPSingleEvent breakpoint(0x00101658);
|
||||
simulator.addEventAndWait(&breakpoint);
|
||||
cout << "[TracingTest] main() reached, saving" << endl;
|
||||
|
||||
simulator.save("state");
|
||||
#else
|
||||
// STEP 2: test tracing plugin
|
||||
simulator.restore("state");
|
||||
|
||||
cout << "[TracingTest] enabling tracing" << endl;
|
||||
|
||||
TracingPlugin tp;
|
||||
ofstream of("trace.pb");
|
||||
tp.setTraceFile(&of);
|
||||
// this must be done *after* configuring the plugin:
|
||||
simulator.addFlow(&tp);
|
||||
|
||||
cout << "[TracingTest] tracing 1000000 instructions" << endl;
|
||||
BPSingleEvent timeout(ANY_ADDR);
|
||||
timeout.setCounter(1000000);
|
||||
simulator.addEvent(&timeout);
|
||||
|
||||
InterruptEvent ie(ANY_INTERRUPT);
|
||||
while (simulator.addEventAndWait(&ie) != &timeout) {
|
||||
cout << "INTERRUPT #" << ie.getTriggerNumber() << "\n";
|
||||
}
|
||||
|
||||
cout << "[TracingTest] tracing finished. (trace.pb)";
|
||||
simulator.removeFlow(&tp);
|
||||
of.close();
|
||||
|
||||
/*
|
||||
// serialize trace to file
|
||||
ofstream of("trace.pb");
|
||||
if (of.fail()) { return false; }
|
||||
trace.SerializeToOstream(&of);
|
||||
of.close();
|
||||
|
||||
// serialize trace to gzip-compressed file
|
||||
int fd = open("trace.pb.gz", O_WRONLY | O_CREAT | O_TRUNC, 0666);
|
||||
if (!fd) { return false; }
|
||||
google::protobuf::io::FileOutputStream fo(fd);
|
||||
google::protobuf::io::GzipOutputStream::Options options;
|
||||
options.compression_level = 9;
|
||||
google::protobuf::io::GzipOutputStream go(&fo, options);
|
||||
trace.SerializeToZeroCopyStream(&go);
|
||||
go.Close();
|
||||
fo.Close();
|
||||
*/
|
||||
#endif
|
||||
cout << "[TracingTest] Finished." << endl;
|
||||
simulator.clearEvents(this);
|
||||
simulator.terminate();
|
||||
|
||||
return true;
|
||||
}
|
||||
11
src/experiments/tracing-test/experiment.hpp
Normal file
11
src/experiments/tracing-test/experiment.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef __TRACING_TEST_HPP__
|
||||
#define __TRACING_TEST_HPP__
|
||||
|
||||
#include "efw/ExperimentFlow.hpp"
|
||||
|
||||
class TracingTest : public fail::ExperimentFlow {
|
||||
public:
|
||||
bool run();
|
||||
};
|
||||
|
||||
#endif // __TRACING_TEST_HPP__
|
||||
Reference in New Issue
Block a user