Add timer for BV inequality solver. (#2265)
authorAina Niemetz <aina.niemetz@gmail.com>
Fri, 3 Aug 2018 00:11:36 +0000 (17:11 -0700)
committerGitHub <noreply@github.com>
Fri, 3 Aug 2018 00:11:36 +0000 (17:11 -0700)
src/theory/bv/bv_subtheory_algebraic.cpp
src/theory/bv/bv_subtheory_inequality.cpp
src/theory/bv/bv_subtheory_inequality.h

index 456f627d0f182d5f4e14f6612e5e8eb23f8ed586..8ea474ad7860235dd7d4f8cfc48f79aaaf537c01 100644 (file)
@@ -2,7 +2,7 @@
 /*! \file bv_subtheory_algebraic.cpp
  ** \verbatim
  ** Top contributors (to current version):
- **   Liana Hadarean, Tim King, Aina Niemetz
+ **   Liana Hadarean, Aina Niemetz, Tim King
  ** This file is part of the CVC4 project.
  ** Copyright (c) 2009-2018 by the authors listed in the file AUTHORS
  ** in the top-level source directory) and their institutional affiliations.
@@ -252,21 +252,16 @@ AlgebraicSolver::~AlgebraicSolver() {
 
 
 
-bool AlgebraicSolver::check(Theory::Effort e) {
+bool AlgebraicSolver::check(Theory::Effort e)
+{
   Assert(options::bitblastMode() == theory::bv::BITBLAST_MODE_LAZY);
 
-  if (!Theory::fullEffort(e)) {
-    return true;
-  }
-
-  if (!useHeuristic()) {
-    return true;
-  }
-
-  ++(d_numCalls);
+  if (!Theory::fullEffort(e)) { return true; }
+  if (!useHeuristic()) { return true; }
 
   TimerStat::CodeTimer algebraicTimer(d_statistics.d_solveTime);
   Debug("bv-subtheory-algebraic") << "AlgebraicSolver::check (" << e << ")\n";
+  ++(d_numCalls);
   ++(d_statistics.d_numCallstoCheck);
 
   d_explanations.clear();
index 41ee74e8d0bf3d3b140ac5dc3d6bb1e7933d4968..6fc167793a5c93fec8024c6790301376335b1d76 100644 (file)
@@ -31,6 +31,7 @@ using namespace CVC4::theory::bv::utils;
 
 bool InequalitySolver::check(Theory::Effort e) {
   Debug("bv-subtheory-inequality") << "InequalitySolveR::check("<< e <<")\n";
+  TimerStat::CodeTimer inequalityTimer(d_statistics.d_solveTime);
   ++(d_statistics.d_numCallstoCheck);
   d_bv->spendResource(options::theoryCheckStep());
 
@@ -246,10 +247,15 @@ bool InequalitySolver::addInequality(TNode a, TNode b, bool strict, TNode fact)
 }
 
 InequalitySolver::Statistics::Statistics()
-  : d_numCallstoCheck("theory::bv::InequalitySolver::NumCallsToCheck", 0)
+    : d_numCallstoCheck("theory::bv::inequality::NumCallsToCheck", 0),
+      d_solveTime("theory::bv::inequality::SolveTime")
 {
   smtStatisticsRegistry()->registerStat(&d_numCallstoCheck);
+  smtStatisticsRegistry()->registerStat(&d_solveTime);
 }
-InequalitySolver::Statistics::~Statistics() {
+
+InequalitySolver::Statistics::~Statistics()
+{
   smtStatisticsRegistry()->unregisterStat(&d_numCallstoCheck);
+  smtStatisticsRegistry()->unregisterStat(&d_solveTime);
 }
index 06c39754f6f35e03d9a79ff2dfff64359b0823ed..1bdec83863a01f680e071774b5683fc987fa21e8 100644 (file)
@@ -38,9 +38,12 @@ typedef expr::Attribute<IneqOnlyAttributeId, bool> IneqOnlyAttribute;
 struct IneqOnlyComputedAttributeId {};
 typedef expr::Attribute<IneqOnlyComputedAttributeId, bool> IneqOnlyComputedAttribute;
 
-class InequalitySolver: public SubtheorySolver {
-  struct Statistics {
+class InequalitySolver : public SubtheorySolver
+{
+  struct Statistics
+  {
     IntStat d_numCallstoCheck;
+    TimerStat d_solveTime;
     Statistics();
     ~Statistics();
   };