Skip to content

Commit 3d226c9

Browse files
authored
Add virtual evaluation to stats (#458)
1 parent 7ad7ec4 commit 3d226c9

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/mine/stats.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
const std::string Stats::CALL_GRAPH_HEADER("caller,callee");
1919
const std::string Stats::PROGRAMS_HEADER(
20-
"id,submitter,length,usages,inc_eval,log_eval,loop,formula");
20+
"id,submitter,length,usages,inc_eval,log_eval,vir_eval,loop,formula");
2121
const std::string Stats::STEPS_HEADER("total,min,max,runs");
2222
const std::string Stats::SUMMARY_HEADER(
2323
"num_sequences,num_programs,num_formulas");
@@ -43,7 +43,7 @@ void Stats::load(std::string path) {
4343
auto start_time = std::chrono::steady_clock::now();
4444

4545
const std::string sep(",");
46-
std::string full, line, k, l, m, v, w, u;
46+
std::string full, line, k, l, m, v, w, u, x;
4747
Parser parser;
4848
Operation op;
4949
Operand count;
@@ -159,6 +159,7 @@ void Stats::load(std::string path) {
159159
std::getline(s, m, ',');
160160
std::getline(s, v, ',');
161161
std::getline(s, w, ',');
162+
std::getline(s, x, ',');
162163
std::getline(s, loop_col, ',');
163164
std::getline(s, formula_col);
164165
UID id(k);
@@ -173,6 +174,9 @@ void Stats::load(std::string path) {
173174
if (std::stoll(w)) {
174175
supports_logeval.insert(id);
175176
}
177+
if (std::stoll(x)) {
178+
supports_vireval.insert(id);
179+
}
176180
if (std::stoll(loop_col)) {
177181
has_loop.insert(id);
178182
}
@@ -278,11 +282,12 @@ void Stats::save(std::string path) {
278282
for (auto id : all_program_ids) {
279283
const auto inceval = supports_inceval.exists(id);
280284
const auto logeval = supports_logeval.exists(id);
285+
const auto vireval = supports_vireval.exists(id);
281286
const auto loop_flag = has_loop.exists(id);
282287
const auto formula_flag = has_formula.exists(id);
283288
programs << id.string() << sep << program_submitter[id] << sep
284289
<< program_lengths[id] << sep << program_usages[id] << sep
285-
<< inceval << sep << logeval << sep << loop_flag << sep
290+
<< inceval << sep << logeval << sep << vireval << sep << loop_flag << sep
286291
<< formula_flag << "\n";
287292
}
288293
programs.close();
@@ -436,12 +441,16 @@ void Stats::updateProgramStats(UID id, const Program &program,
436441
Settings settings;
437442
Interpreter interpreter(settings);
438443
IncrementalEvaluator inceval(interpreter);
444+
VirtualEvaluator vireval(settings);
439445
if (inceval.init(program)) {
440446
supports_inceval.insert(id);
441447
}
442448
if (Analyzer::hasLogarithmicComplexity(program)) {
443449
supports_logeval.insert(id);
444450
}
451+
if (vireval.init(program)) {
452+
supports_vireval.insert(id);
453+
}
445454
if (with_loop) {
446455
has_loop.insert(id);
447456
}

src/mine/stats.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class Stats {
7373
UIDSet latest_program_ids;
7474
UIDSet supports_inceval;
7575
UIDSet supports_logeval;
76+
UIDSet supports_vireval;
7677
UIDSet has_loop;
7778
UIDSet has_formula;
7879
Blocks blocks;

0 commit comments

Comments
 (0)