diff options
author | Gereon Kremer <nafur42@gmail.com> | 2021-09-11 21:13:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-11 19:13:34 +0000 |
commit | 2384a8d85517e00bc94e7fcf759a75dc6ea9b009 (patch) | |
tree | e4d8084d774b7ad334c0c2b91a7d985d876a990e /src/util/statistics_registry.cpp | |
parent | b85e8a3d3f66ca844dc9b4790cd549a8dd0739a7 (diff) |
Use StatisticsRegistry from Env (#7166)
This commit better integrates the StatisticsRegistry with the environment. It makes the registry an `EnvObj` itself and adds a getter to `EnvObj` to get the registry. It also refactors parts of cvc5 to use this new mechanism to obtain the registry instead of using the (global, static) `smtStatisticsRegistry()` function.
Diffstat (limited to 'src/util/statistics_registry.cpp')
-rw-r--r-- | src/util/statistics_registry.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/util/statistics_registry.cpp b/src/util/statistics_registry.cpp index 51da36aba..815c61059 100644 --- a/src/util/statistics_registry.cpp +++ b/src/util/statistics_registry.cpp @@ -22,7 +22,8 @@ namespace cvc5 { -StatisticsRegistry::StatisticsRegistry(bool registerPublic) +StatisticsRegistry::StatisticsRegistry(Env& env, bool registerPublic) + : EnvObj(env) { if (registerPublic) { @@ -52,8 +53,8 @@ void StatisticsRegistry::storeSnapshot() d_lastSnapshot = std::make_unique<Snapshot>(); for (const auto& s : d_stats) { - if (!options::statisticsExpert() && s.second->d_expert) continue; - if (!options::statisticsAll() && s.second->isDefault()) continue; + if (!options().base.statisticsExpert && s.second->d_expert) continue; + if (!options().base.statisticsAll && s.second->isDefault()) continue; d_lastSnapshot->emplace( s.first, s.second->getViewer()); @@ -78,8 +79,8 @@ void StatisticsRegistry::print(std::ostream& os) const { for (const auto& s : d_stats) { - if (!options::statisticsExpert() && s.second->d_expert) continue; - if (!options::statisticsAll() && s.second->isDefault()) continue; + if (!options().base.statisticsExpert && s.second->d_expert) continue; + if (!options().base.statisticsAll && s.second->isDefault()) continue; os << s.first << " = " << *s.second << std::endl; } } @@ -91,8 +92,8 @@ void StatisticsRegistry::printSafe(int fd) const { for (const auto& s : d_stats) { - if (!options::statisticsExpert() && s.second->d_expert) continue; - if (!options::statisticsAll() && s.second->isDefault()) continue; + if (!options().base.statisticsExpert && s.second->d_expert) continue; + if (!options().base.statisticsAll && s.second->isDefault()) continue; safe_print(fd, s.first); safe_print(fd, " = "); @@ -113,8 +114,8 @@ void StatisticsRegistry::printDiff(std::ostream& os) const } for (const auto& s : d_stats) { - if (!options::statisticsExpert() && s.second->d_expert) continue; - if (!options::statisticsAll() && s.second->isDefault()) + if (!options().base.statisticsExpert && s.second->d_expert) continue; + if (!options().base.statisticsAll && s.second->isDefault()) { auto oldit = d_lastSnapshot->find(s.first); if (oldit != d_lastSnapshot->end() && oldit->second != s.second->getViewer()) |