Skip to content

Commit 73000ed

Browse files
committed
Store stats where they belong
1 parent 73d5fa1 commit 73000ed

File tree

6 files changed

+11
-16
lines changed

6 files changed

+11
-16
lines changed

src/comp_analyzer.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,7 @@ void CompAnalyzer::record_comp(const uint32_t var, const uint32_t sup_comp_long_
228228

229229
debug_print(COLWHT "We are NOW going through all binary/tri/long clauses "
230230
"recursively and put into search_stack_ all the variables that are connected to var: " << var);
231-
if (comps_recorded % (128*1024*1024) == 0 && reset_comps+non_reset_comps > 0) {
232-
verb_print(1, "[record_comp] Tot recorded " << (comps_recorded)/1000 << "K non-reset ratio: "
233-
<< (double)(non_reset_comps)/(double)(reset_comps+non_reset_comps));
234-
}
235-
comps_recorded++;
231+
stats.comps_recorded++;
236232

237233
for (auto vt = comp_vars.begin(); vt != comp_vars.end(); vt++) {
238234
const auto v = *vt;
@@ -251,9 +247,9 @@ void CompAnalyzer::record_comp(const uint32_t var, const uint32_t sup_comp_long_
251247
if (holder.tstamp(v) < counter->get_tstamp(holder.lev(v))) {
252248
/* holder.size_bin(v) = holder.orig_size_bin(v); */
253249
holder.size_long(v) = holder.orig_size_long(v);
254-
reset_comps++;
250+
stats.comps_reset++;
255251
} else {
256-
non_reset_comps++;
252+
stats.comps_non_reset++;
257253
}
258254
holder.lev(v) = counter->dec_level();
259255
holder.tstamp(v) = counter->get_tstamp();
@@ -392,6 +388,7 @@ end_sat:;
392388
CompAnalyzer::CompAnalyzer(
393389
const LiteralIndexedVector<TriValue> & lit_values,
394390
Counter* _counter) :
391+
stats(_counter->get_stats()),
395392
values(lit_values),
396393
conf(_counter->get_conf()),
397394
indep_support_end(_counter->get_indep_support_end()),

src/comp_analyzer.hpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ struct MyHolder {
110110
uint32_t& orig_size_long(uint32_t v) { return data[v*hstride+offset+5];}
111111
void pop_back_long(uint32_t v) { size_long(v)--; }
112112
void resize_long(uint32_t v, uint32_t sz) { size_long(v) = sz; }
113-
114113
};
115114

116115
// There is exactly ONE of this, inside CompManager, which is inside counter
@@ -184,9 +183,7 @@ class CompAnalyzer {
184183
uint32_t max_clid = 0;
185184
uint32_t max_tri_clid = 0;
186185
uint32_t max_var = 0;
187-
uint64_t reset_comps = 0;
188-
uint64_t non_reset_comps = 0;
189-
uint32_t comps_recorded = 0;
186+
DataAndStatistics& stats;
190187

191188
MyHolder holder;
192189
vector<Lit> long_clauses_data;

src/counter.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2189,9 +2189,6 @@ bool Counter::propagate(bool out_of_order) {
21892189
return confl.isNull();
21902190
}
21912191

2192-
const DataAndStatistics& Counter::get_stats() const {
2193-
return stats; }
2194-
21952192
bool Counter::lit_redundant(Lit p, uint32_t abstract_levels) {
21962193
debug_print(__func__ << " called");
21972194

src/counter.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ class Counter {
196196
const FG& get_fg() const { return fg; }
197197
const FF& get_two() const { return two; }
198198
bool weighted() const { return fg->weighted(); }
199+
DataAndStatistics& get_stats() { return stats; }
199200

200201
private:
201202
FG fg;
@@ -259,8 +260,6 @@ class Counter {
259260
vector<map<Lit, Lit>> generators;
260261
void symm_cubes(vector<Cube>& cubes);
261262

262-
const DataAndStatistics& get_stats() const;
263-
264263
//Debug stuff
265264
FF check_count(const bool also_incl_curr_and_later_dec = false);
266265
bool is_implied(const vector<Lit>& cp);

src/statistics.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ void DataAndStatistics::print_short(const Counter* counter, const CompCache* cac
115115
<< setw(5) << comp_sorts/1000 << " / "
116116
<< setw(5) << std::setprecision(8) << safe_div(comp_sizes, comp_sorts))
117117
<< std::setprecision(2);
118+
verb_print(1, "comps recordK/non-reset ratio " << comps_recorded/1000 << " / "
119+
<< (double)(comps_non_reset)/(double)(comps_reset+comps_non_reset));
118120

119121
verb_print(1, "vivif: try/cls/clviv/litsravg "
120122
<< setw(9) << vivif_tried << " "

src/statistics.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ class DataAndStatistics {
125125
// Components
126126
uint64_t comp_sorts = 0;
127127
uint64_t comp_sizes = 0;
128+
uint64_t comps_reset = 0;
129+
uint64_t comps_non_reset = 0;
130+
uint32_t comps_recorded = 0;
128131

129132
uint64_t num_cached_comps = 0;
130133
uint64_t total_num_cached_comps = 0;

0 commit comments

Comments
 (0)