#include "util/output.h"
#include "util/dump.h"
#include "util/result.h"
+#include "util/statistics_registry.h"
using namespace std;
using namespace CVC4;
/** A pointer to the CommandExecutor (the signal handlers need it) */
CVC4::main::CommandExecutor* pExecutor = NULL;
+ /** A pointer to the totalTime driver stat (the signal handlers need it) */
+ CVC4::TimerStat* pTotalTime = NULL;
+
}/* CVC4::main namespace */
}/* CVC4 namespace */
int runCvc4(int argc, char* argv[], Options& opts) {
// Timer statistic
- TimerStat s_totalTime("totalTime");
- s_totalTime.start();
+ pTotalTime = new TimerStat("totalTime");
+ pTotalTime->start();
// For the signal handlers' benefit
pOptions = &opts;
int returnValue = 0;
{
// Timer statistic
- RegisterStatistic statTotalTime(&pExecutor->getStatisticsRegistry(), &s_totalTime);
+ RegisterStatistic statTotalTime(&pExecutor->getStatisticsRegistry(), pTotalTime);
// Filename statistics
ReferenceStat< const char* > s_statFilename("filename", filename);
ReferenceStat< Result > s_statSatResult("sat/unsat", result);
RegisterStatistic statSatResultReg(&pExecutor->getStatisticsRegistry(), &s_statSatResult);
- s_totalTime.stop();
+ pTotalTime->stop();
// Set the global executor pointer to NULL first. If we get a
// signal while dumping statistics, we don't want to try again.
// On exceptional exit, these are leaked, but that's okay... they
// need to be around in that case for main() to print statistics.
+ delete pTotalTime;
delete pExecutor;
delete exprMgr;
+ pTotalTime = NULL;
pExecutor = NULL;
return returnValue;
#include "util/exception.h"
#include "util/statistics.h"
#include "util/tls.h"
+#include "util/statistics_registry.h"
#include "cvc4autoconfig.h"
#ifndef __CVC4__MAIN__MAIN_H
/** A reference for use by the signal handlers to print statistics */
extern CVC4::main::CommandExecutor* pExecutor;
+/** A reference for use by the signal handlers to print statistics */
+extern CVC4::TimerStat* pTotalTime;
+
/**
* If true, will not spin on segfault even when CVC4_DEBUG is on.
* Useful for nightly regressions, noninteractive performance runs
void timeout_handler(int sig, siginfo_t* info, void*) {
fprintf(stderr, "CVC4 interrupted by timeout.\n");
if((*pOptions)[options::statistics] && pExecutor != NULL) {
+ pTotalTime->stop();
pExecutor->flushStatistics(cerr);
}
abort();
void sigint_handler(int sig, siginfo_t* info, void*) {
fprintf(stderr, "CVC4 interrupted by user.\n");
if((*pOptions)[options::statistics] && pExecutor != NULL) {
+ pTotalTime->stop();
pExecutor->flushStatistics(cerr);
}
abort();
if(segvNoSpin) {
fprintf(stderr, "No-spin requested, aborting...\n");
if((*pOptions)[options::statistics] && pExecutor != NULL) {
+ pTotalTime->stop();
pExecutor->flushStatistics(cerr);
}
abort();
cerr << "Looks like a NULL pointer was dereferenced." << endl;
}
if((*pOptions)[options::statistics] && pExecutor != NULL) {
+ pTotalTime->stop();
pExecutor->flushStatistics(cerr);
}
abort();
if(segvNoSpin) {
fprintf(stderr, "No-spin requested, aborting...\n");
if((*pOptions)[options::statistics] && pExecutor != NULL) {
+ pTotalTime->stop();
pExecutor->flushStatistics(cerr);
}
abort();
#else /* CVC4_DEBUG */
fprintf(stderr, "CVC4 executed an illegal instruction.\n");
if((*pOptions)[options::statistics] && pExecutor != NULL) {
+ pTotalTime->stop();
pExecutor->flushStatistics(cerr);
}
abort();
if(segvNoSpin) {
fprintf(stderr, "No-spin requested.\n");
if((*pOptions)[options::statistics] && pExecutor != NULL) {
+ pTotalTime->stop();
pExecutor->flushStatistics(cerr);
}
set_terminate(default_terminator);
#else /* CVC4_DEBUG */
fprintf(stderr, "CVC4 threw an \"unexpected\" exception.\n");
if((*pOptions)[options::statistics] && pExecutor != NULL) {
+ pTotalTime->stop();
pExecutor->flushStatistics(cerr);
}
set_terminate(default_terminator);
"Perhaps an exception was thrown during stack unwinding. "
"(Don't do that.)\n");
if((*pOptions)[options::statistics] && pExecutor != NULL) {
+ pTotalTime->stop();
pExecutor->flushStatistics(cerr);
}
default_terminator();
"CVC4 was terminated by the C++ runtime.\n"
"Perhaps an exception was thrown during stack unwinding.\n");
if((*pOptions)[options::statistics] && pExecutor != NULL) {
+ pTotalTime->stop();
pExecutor->flushStatistics(cerr);
}
default_terminator();