This PR uses IntegralHistogramStat instead of HistogramStat when appropriate, that is everywhere.
ProofCheckerStatistics();
~ProofCheckerStatistics();
/** Counts the number of checks for each kind of proof rule */
- HistogramStat<PfRule> d_ruleChecks;
+ IntegralHistogramStat<PfRule> d_ruleChecks;
/** Total number of rule checks */
IntStat d_totalRuleChecks;
};
IntStat d_specialEqualityFolds;
IntStat d_simpITEVisits;
- HistogramStat<uint32_t> d_inSmaller;
+ IntegralHistogramStat<uint32_t> d_inSmaller;
Statistics();
~Statistics();
IntStat d_numLearnedInProof;
IntStat d_numLemmasInProof;
AverageStat d_avgChainLength;
- HistogramStat<uint64_t> d_resChainLengths;
- HistogramStat<uint64_t> d_usedResChainLengths;
- HistogramStat<uint64_t> d_clauseGlue;
- HistogramStat<uint64_t> d_usedClauseGlue;
+ IntegralHistogramStat<uint64_t> d_resChainLengths;
+ IntegralHistogramStat<uint64_t> d_usedResChainLengths;
+ IntegralHistogramStat<uint64_t> d_clauseGlue;
+ IntegralHistogramStat<uint64_t> d_usedClauseGlue;
Statistics(const std::string& name);
~Statistics();
};
private:
/** Counts number of postprocessed proof nodes for each kind of proof rule */
- HistogramStat<PfRule> d_ruleCount;
+ IntegralHistogramStat<PfRule> d_ruleCount;
/** Total number of postprocessed rule applications */
IntStat d_totalRuleCount;
/** The minimum pedantic level of any rule encountered */
IntStat d_cutsRejectedDuringReplay;
IntStat d_cutsRejectedDuringLemmas;
- HistogramStat<uint32_t> d_satPivots;
- HistogramStat<uint32_t> d_unsatPivots;
- HistogramStat<uint32_t> d_unknownPivots;
+ IntegralHistogramStat<uint32_t> d_satPivots;
+ IntegralHistogramStat<uint32_t> d_unsatPivots;
+ IntegralHistogramStat<uint32_t> d_unknownPivots;
IntStat d_solveIntModelsAttempts;
{
}
-BagsRewriter::BagsRewriter(HistogramStat<Rewrite>* statistics)
+BagsRewriter::BagsRewriter(IntegralHistogramStat<Rewrite>* statistics)
: d_statistics(statistics)
{
d_nm = NodeManager::currentNM();
class BagsRewriter : public TheoryRewriter
{
public:
- BagsRewriter(HistogramStat<Rewrite>* statistics = nullptr);
+ BagsRewriter(IntegralHistogramStat<Rewrite>* statistics = nullptr);
/**
* postRewrite nodes with kinds: MK_BAG, BAG_COUNT, UNION_MAX, UNION_DISJOINT,
Node d_zero;
Node d_one;
/** Reference to the rewriter statistics. */
- HistogramStat<Rewrite>* d_statistics;
+ IntegralHistogramStat<Rewrite>* d_statistics;
}; /* class TheoryBagsRewriter */
} // namespace bags
~BagsStatistics();
/** Counts the number of applications of each type of rewrite rule */
- HistogramStat<Rewrite> d_rewrites;
+ IntegralHistogramStat<Rewrite> d_rewrites;
};
} // namespace bags
namespace theory {
namespace strings {
-SequencesRewriter::SequencesRewriter(HistogramStat<Rewrite>* statistics)
+SequencesRewriter::SequencesRewriter(IntegralHistogramStat<Rewrite>* statistics)
: d_statistics(statistics), d_stringsEntail(*this)
{
}
class SequencesRewriter : public TheoryRewriter
{
public:
- SequencesRewriter(HistogramStat<Rewrite>* statistics);
+ SequencesRewriter(IntegralHistogramStat<Rewrite>* statistics);
protected:
/** rewrite regular expression concatenation
static Node canonicalStrForSymbolicLength(Node n, TypeNode stype);
/** Reference to the rewriter statistics. */
- HistogramStat<Rewrite>* d_statistics;
+ IntegralHistogramStat<Rewrite>* d_statistics;
/** Instance of the entailment checker for strings. */
StringsEntail d_stringsEntail;
* TheoryInferenceManager, i.e.
* (theory::strings::inferences{Facts,Lemmas,Conflicts}).
*/
- HistogramStat<InferenceId> d_inferencesNoPf;
+ IntegralHistogramStat<InferenceId> d_inferencesNoPf;
/**
* Counts the number of applications of each type of context-dependent
* simplification. The sum of this map is equal to the number of EXTF or
* EXTF_N inferences.
*/
- HistogramStat<Kind> d_cdSimplifications;
+ IntegralHistogramStat<Kind> d_cdSimplifications;
/**
* Counts the number of applications of each type of reduction. The sum of
* this map is equal to the number of REDUCTION inferences (when
* options::stringLazyPreproc is true).
*/
- HistogramStat<Kind> d_reductions;
+ IntegralHistogramStat<Kind> d_reductions;
/**
* Counts the number of applications of each type of regular expression
* positive (resp. negative) unfoldings. The sum of this map is equal to the
* number of RE_UNFOLD_POS (resp. RE_UNFOLD_NEG) inferences.
*/
- HistogramStat<Kind> d_regexpUnfoldingsPos;
- HistogramStat<Kind> d_regexpUnfoldingsNeg;
+ IntegralHistogramStat<Kind> d_regexpUnfoldingsPos;
+ IntegralHistogramStat<Kind> d_regexpUnfoldingsNeg;
//--------------- end of inferences
/** Counts the number of applications of each type of rewrite rule */
- HistogramStat<Rewrite> d_rewrites;
+ IntegralHistogramStat<Rewrite> d_rewrites;
//--------------- conflicts, partition of calls to OutputChannel::conflict
/** Number of equality engine conflicts */
IntStat d_conflictsEqEngine;
namespace theory {
namespace strings {
-StringsRewriter::StringsRewriter(HistogramStat<Rewrite>* statistics)
+StringsRewriter::StringsRewriter(IntegralHistogramStat<Rewrite>* statistics)
: SequencesRewriter(statistics)
{
}
class StringsRewriter : public SequencesRewriter
{
public:
- StringsRewriter(HistogramStat<Rewrite>* statistics);
+ StringsRewriter(IntegralHistogramStat<Rewrite>* statistics);
RewriteResponse postRewrite(TNode node) override;
typedef expr::Attribute<QInternalVarAttributeId, Node> QInternalVarAttribute;
StringsPreprocess::StringsPreprocess(SkolemCache* sc,
- HistogramStat<Kind>* statReductions)
+ IntegralHistogramStat<Kind>* statReductions)
: d_sc(sc), d_statReductions(statReductions)
{
}
class StringsPreprocess {
public:
StringsPreprocess(SkolemCache* sc,
- HistogramStat<Kind>* statReductions = nullptr);
+ IntegralHistogramStat<Kind>* statReductions = nullptr);
~StringsPreprocess();
/** The reduce routine
*
/** pointer to the skolem cache used by this class */
SkolemCache* d_sc;
/** Reference to the statistics for the theory of strings/sequences. */
- HistogramStat<Kind>* d_statReductions;
+ IntegralHistogramStat<Kind>* d_statReductions;
/** visited cache */
std::map<Node, Node> d_visited;
/**
namespace CVC4 {
-template <class T>
-class HistogramStat : public Stat
-{
- using Histogram = std::map<T, uint64_t>;
- public:
- /** Construct a histogram of a stream of entries. */
- HistogramStat(const std::string& name) : Stat(name) {}
-
- void flushInformation(std::ostream& out) const override
- {
- auto i = d_hist.begin();
- auto end = d_hist.end();
- out << "[";
- while (i != end)
- {
- const T& key = (*i).first;
- uint64_t count = (*i).second;
- out << "(" << key << " : " << count << ")";
- ++i;
- if (i != end)
- {
- out << ", ";
- }
- }
- out << "]";
- }
-
- void safeFlushInformation(int fd) const override
- {
- auto i = d_hist.begin();
- auto end = d_hist.end();
- safe_print(fd, "[");
- while (i != end)
- {
- const T& key = (*i).first;
- uint64_t count = (*i).second;
- safe_print(fd, "(");
- safe_print<T>(fd, key);
- safe_print(fd, " : ");
- safe_print<uint64_t>(fd, count);
- safe_print(fd, ")");
- ++i;
- if (i != end)
- {
- safe_print(fd, ", ");
- }
- }
- safe_print(fd, "]");
- }
-
- HistogramStat& operator<<(const T& val)
- {
- if (CVC4_USE_STATISTICS)
- {
- if (d_hist.find(val) == d_hist.end())
- {
- d_hist.insert(std::make_pair(val, 0));
- }
- d_hist[val]++;
- }
- return (*this);
- }
-
- private:
- Histogram d_hist;
-}; /* class HistogramStat */
-
/**
* A histogram statistic class for integral types.
- * Avoids using an std::map (like the generic HistogramStat) in favor of a
+ * Avoids using an std::map (like we would do for generic types) in favor of a
* faster std::vector by casting the integral values to indices into the
* vector. Requires the type to be an integral type that is convertible to
* int64_t, also supporting appropriate enum types.
BackedStat<double> backedDoubleNoDec("backedDoubleNoDec", 2.0);
BackedStat<bool> backedBool("backedBool", true);
BackedStat<void*> backedAddr("backedDouble", (void*)0xDEADBEEF);
- HistogramStat<int64_t> histStat("hist");
- histStat << 5;
- histStat << 6;
- histStat << 5;
- histStat << 10;
- histStat << 10;
- histStat << 0;
IntegralHistogramStat<std::int64_t> histIntStat("hist-int");
histIntStat << 15 << 16 << 15 << 14 << 16;
IntegralHistogramStat<CVC4::PfRule> histPfRuleStat("hist-pfrule");
safe_print(fd, "\n");
backedBool.safeFlushInformation(fd);
safe_print(fd, "\n");
- histStat.safeFlushInformation(fd);
- safe_print(fd, "\n");
histIntStat.safeFlushInformation(fd);
safe_print(fd, "\n");
histPfRuleStat.safeFlushInformation(fd);
"2.0\n"
"0xdeadbeef\n"
"true\n"
- "[(0 : 1), (5 : 2), (6 : 1), (10 : 2)]\n"
"[(14 : 1), (15 : 2), (16 : 2)]\n"
"[(ASSUME : 2), (SCOPE : 1)]\n"
"<unsupported>";