Skip to content

Commit

Permalink
Mutator: add queue-to-all summary to success_rate_variable
Browse files Browse the repository at this point in the history
  • Loading branch information
atrosinenko committed Sep 24, 2023
1 parent ff9a27a commit a3bfc21
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions runtime/mutators/tests/success-rate.out
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
never_0 (-nan), never_2 (0.00), rare_3 (0.33), half_2 (0.50), frequent_4 (0.75), always_3 (1.00)
- Success (all):
never_0 (-nan), never_2 (0.00), rare_3 (0.33), half_2 (0.50), frequent_4 (0.75), always_3 (1.00)
- Success (queue-to-all):
never_0 (-nan), never_2 (-nan), always_3 (1.00), frequent_4 (1.00), rare_3 (1.00), half_2 (1.00)
15 changes: 10 additions & 5 deletions runtime/mutators/variables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,19 @@ void success_rate_variable::print(FILE *stream, unsigned var_index) {
auto total_acc = [this](unsigned i) {
return 0.0 + Success->get_accumulated(i) + Failure->get_accumulated(i);
};
auto percent = [this, total](unsigned i) {
return Success->get(i) / total(i);
};
auto percent_acc = [this, total_acc](unsigned i) {
return Success->get_accumulated(i) / total_acc(i);
};
fprintf(stderr, "Variable #%u: %s\n", var_index, Name.c_str());
print_summary(stream, "Usage count (queue)", total_acc);
print_summary(stream, "Usage count (all)", total);
print_summary(stream, "Success (queue)", [this, total_acc](unsigned i) {
return Success->get_accumulated(i) / total_acc(i);
});
print_summary(stream, "Success (all)", [this, total](unsigned i) {
return Success->get(i) / total(i);
print_summary(stream, "Success (queue)", percent_acc);
print_summary(stream, "Success (all)", percent);
print_summary(stream, "Success (queue-to-all)", [percent_acc, percent](unsigned i) {
return percent_acc(i) / percent(i);
});
}

Expand Down

0 comments on commit a3bfc21

Please sign in to comment.