diff options
author | Gereon Kremer <gereon.kremer@cs.rwth-aachen.de> | 2021-04-14 21:37:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-14 19:37:12 +0000 |
commit | 9f14a0d6feca8d8ba727f88ef7dda5268183bb56 (patch) | |
tree | 54d1500f368312ade8abb1fb9962976ae61bedfc /src/expr | |
parent | e5c26181dab76704ad9a47126585fe2ec9d6cac2 (diff) |
Refactor / reimplement statistics (#6162)
This PR refactors how we collect statistics.
It splits the current statistic values into the values and a proxy object. The actual values now live inside the registry (making the ownership model way easier) while the proxy object are handed to whoever wants to collect a new statistic.
It also extends the C++ API to obtain and inspect the statistics.
To change the ownership, this PR needs to touch every single statistic in the whole codebase and change how it is registered.
Diffstat (limited to 'src/expr')
-rw-r--r-- | src/expr/proof_checker.cpp | 14 | ||||
-rw-r--r-- | src/expr/proof_checker.h | 6 |
2 files changed, 6 insertions, 14 deletions
diff --git a/src/expr/proof_checker.cpp b/src/expr/proof_checker.cpp index 5cd7d225d..69f880ed5 100644 --- a/src/expr/proof_checker.cpp +++ b/src/expr/proof_checker.cpp @@ -77,17 +77,11 @@ Node ProofRuleChecker::mkKindNode(Kind k) } ProofCheckerStatistics::ProofCheckerStatistics() - : d_ruleChecks("ProofCheckerStatistics::ruleChecks"), - d_totalRuleChecks("ProofCheckerStatistics::totalRuleChecks", 0) + : d_ruleChecks(smtStatisticsRegistry().registerHistogram<PfRule>( + "ProofCheckerStatistics::ruleChecks")), + d_totalRuleChecks(smtStatisticsRegistry().registerInt( + "ProofCheckerStatistics::totalRuleChecks")) { - smtStatisticsRegistry()->registerStat(&d_ruleChecks); - smtStatisticsRegistry()->registerStat(&d_totalRuleChecks); -} - -ProofCheckerStatistics::~ProofCheckerStatistics() -{ - smtStatisticsRegistry()->unregisterStat(&d_ruleChecks); - smtStatisticsRegistry()->unregisterStat(&d_totalRuleChecks); } Node ProofChecker::check(ProofNode* pn, Node expected) diff --git a/src/expr/proof_checker.h b/src/expr/proof_checker.h index 69be40ad0..e778f687e 100644 --- a/src/expr/proof_checker.h +++ b/src/expr/proof_checker.h @@ -22,8 +22,7 @@ #include "expr/node.h" #include "expr/proof_rule.h" -#include "util/statistics_registry.h" -#include "util/stats_histogram.h" +#include "util/statistics_stats.h" namespace cvc5 { @@ -92,9 +91,8 @@ class ProofCheckerStatistics { public: ProofCheckerStatistics(); - ~ProofCheckerStatistics(); /** Counts the number of checks for each kind of proof rule */ - IntegralHistogramStat<PfRule> d_ruleChecks; + HistogramStat<PfRule> d_ruleChecks; /** Total number of rule checks */ IntStat d_totalRuleChecks; }; |