aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/Core/ExecutorTimers.cpp
diff options
context:
space:
mode:
authorFrank Busse <bb0xfb@gmail.com>2019-07-30 14:17:17 +0100
committerCristian Cadar <c.cadar@imperial.ac.uk>2019-08-15 16:26:20 +0100
commit8a531bf8f276274b146dbb245293b06d31dfaef4 (patch)
treeb2376ac5f636e583c018f5368091a64a688b03d3 /lib/Core/ExecutorTimers.cpp
parentae521364b55dc4e47dc9248cdc6035e7bfa3070e (diff)
downloadklee-8a531bf8f276274b146dbb245293b06d31dfaef4.tar.gz
ExecutorTimers: move dumpStates/dumpPTree into Executor
* creates two new methods: dumpStates, dumpPTree
Diffstat (limited to 'lib/Core/ExecutorTimers.cpp')
-rw-r--r--lib/Core/ExecutorTimers.cpp66
1 files changed, 3 insertions, 63 deletions
diff --git a/lib/Core/ExecutorTimers.cpp b/lib/Core/ExecutorTimers.cpp
index e1d6684d..81ab7651 100644
--- a/lib/Core/ExecutorTimers.cpp
+++ b/lib/Core/ExecutorTimers.cpp
@@ -62,10 +62,6 @@ public:
static const time::Span kMilliSecondsPerTick(time::milliseconds(100));
static volatile unsigned timerTicks = 0;
-// XXX hack
-extern "C" unsigned dumpStates, dumpPTree;
-unsigned dumpStates = 0, dumpPTree = 0;
-
static void onAlarm(int) {
++timerTicks;
}
@@ -114,63 +110,7 @@ void Executor::processTimers(ExecutionState *current,
ticks = 1;
}
- if (ticks || dumpPTree || dumpStates) {
- if (dumpPTree) {
- char name[32];
- snprintf(name, sizeof(name), "ptree%08d.dot", (int) stats::instructions);
- auto os = interpreterHandler->openOutputFile(name);
- if (os) {
- processTree->dump(*os);
- }
-
- dumpPTree = 0;
- }
-
- if (dumpStates) {
- auto os = interpreterHandler->openOutputFile("states.txt");
-
- if (os) {
- for (ExecutionState *es : states) {
- *os << "(" << es << ",";
- *os << "[";
- auto next = es->stack.begin();
- ++next;
- for (auto sfIt = es->stack.begin(), sf_ie = es->stack.end();
- sfIt != sf_ie; ++sfIt) {
- *os << "('" << sfIt->kf->function->getName().str() << "',";
- if (next == es->stack.end()) {
- *os << es->prevPC->info->line << "), ";
- } else {
- *os << next->caller->info->line << "), ";
- ++next;
- }
- }
- *os << "], ";
-
- StackFrame &sf = es->stack.back();
- uint64_t md2u = computeMinDistToUncovered(es->pc,
- sf.minDistToUncoveredOnReturn);
- uint64_t icnt = theStatisticManager->getIndexedValue(stats::instructions,
- es->pc->info->id);
- uint64_t cpicnt = sf.callPathNode->statistics.getValue(stats::instructions);
-
- *os << "{";
- *os << "'depth' : " << es->depth << ", ";
- *os << "'weight' : " << es->weight << ", ";
- *os << "'queryCost' : " << es->queryCost << ", ";
- *os << "'coveredNew' : " << es->coveredNew << ", ";
- *os << "'instsSinceCovNew' : " << es->instsSinceCovNew << ", ";
- *os << "'md2u' : " << md2u << ", ";
- *os << "'icnt' : " << icnt << ", ";
- *os << "'CPicnt' : " << cpicnt << ", ";
- *os << "}";
- *os << ")\n";
- }
- }
-
- dumpStates = 0;
- }
-
+ if (ticks) {
if (maxInstTime && current &&
std::find(removedStates.begin(), removedStates.end(), current) ==
removedStates.end()) {
@@ -183,10 +123,10 @@ void Executor::processTimers(ExecutionState *current,
if (!timers.empty()) {
auto time = time::getWallTime();
- for (std::vector<TimerInfo*>::iterator it = timers.begin(),
+ for (std::vector<TimerInfo*>::iterator it = timers.begin(),
ie = timers.end(); it != ie; ++it) {
TimerInfo *ti = *it;
-
+
if (time >= ti->nextFireTime) {
ti->timer->run();
ti->nextFireTime = time + ti->rate;