From: lianah Date: Sat, 22 Nov 2014 18:11:19 +0000 (-0800) Subject: added number of resource units used as a stat X-Git-Tag: cvc5-1.0.0~6478^2~7 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=38e077ab219082ee044c2e17ed809e3519c80842;p=cvc5.git added number of resource units used as a stat --- diff --git a/src/smt/smt_engine.cpp b/src/smt/smt_engine.cpp index 74cdee0b7..8f5ba2024 100644 --- a/src/smt/smt_engine.cpp +++ b/src/smt/smt_engine.cpp @@ -209,6 +209,8 @@ struct SmtEngineStatistics { /** Has something simplified to false? */ IntStat d_simplifiedToFalse; + /** Number of resource units spent. */ + ReferenceStat d_resourceUnitsUsed; SmtEngineStatistics() : d_definitionExpansionTime("smt::SmtEngine::definitionExpansionTime"), @@ -231,7 +233,8 @@ struct SmtEngineStatistics { d_solveTime("smt::SmtEngine::solveTime"), d_pushPopTime("smt::SmtEngine::pushPopTime"), d_processAssertionsTime("smt::SmtEngine::processAssertionsTime"), - d_simplifiedToFalse("smt::SmtEngine::simplifiedToFalse", 0) + d_simplifiedToFalse("smt::SmtEngine::simplifiedToFalse", 0), + d_resourceUnitsUsed("smt::SmtEngine::resourceUnitsUsed") { StatisticsRegistry::registerStat(&d_definitionExpansionTime); @@ -255,6 +258,7 @@ struct SmtEngineStatistics { StatisticsRegistry::registerStat(&d_pushPopTime); StatisticsRegistry::registerStat(&d_processAssertionsTime); StatisticsRegistry::registerStat(&d_simplifiedToFalse); + StatisticsRegistry::registerStat(&d_resourceUnitsUsed); } ~SmtEngineStatistics() { @@ -279,6 +283,7 @@ struct SmtEngineStatistics { StatisticsRegistry::unregisterStat(&d_pushPopTime); StatisticsRegistry::unregisterStat(&d_processAssertionsTime); StatisticsRegistry::unregisterStat(&d_simplifiedToFalse); + StatisticsRegistry::unregisterStat(&d_resourceUnitsUsed); } };/* struct SmtEngineStatistics */ @@ -708,7 +713,7 @@ SmtEngine::SmtEngine(ExprManager* em) throw() : d_private = new smt::SmtEnginePrivate(*this); d_statisticsRegistry = new StatisticsRegistry(); d_stats = new SmtEngineStatistics(); - + d_stats->d_resourceUnitsUsed.setData(d_private->getResourceManager()->d_cumulativeResourceUsed); // We have mutual dependency here, so we add the prop engine to the theory // engine later (it is non-essential there) d_theoryEngine = new TheoryEngine(d_context, d_userContext, d_private->d_iteRemover, const_cast(d_logic)); diff --git a/src/util/resource_manager.cpp b/src/util/resource_manager.cpp index b0fd37fd2..7aeb2fc0f 100644 --- a/src/util/resource_manager.cpp +++ b/src/util/resource_manager.cpp @@ -172,10 +172,10 @@ unsigned long ResourceManager::getTimeRemaining() const { void ResourceManager::spendResource() throw (UnsafeInterruptException) { ++d_spendResourceCalls; + ++d_cumulativeResourceUsed; if (!d_on) return; Debug("limit") << "ResourceManager::spendResource()" << std::endl; - ++d_cumulativeResourceUsed; ++d_thisCallResourceUsed; if(out()) { Trace("limit") << "ResourceManager::spendResource: interrupt!" << std::endl; diff --git a/src/util/resource_manager.h b/src/util/resource_manager.h index a16f60910..94e7dbba2 100644 --- a/src/util/resource_manager.h +++ b/src/util/resource_manager.h @@ -150,7 +150,7 @@ public: void endCall(); static unsigned long getFrequencyCount() { return s_resourceCount; } - + friend class SmtEngine; };/* class ResourceManager */ }/* CVC4 namespace */