int precision;
VResult vec;
Result total;
+ bool forceSubnames = false;
void operator()(ostream &stream) const;
};
bool havesub = !subnames.empty();
if (_size == 1) {
+ // If forceSubnames is set, get the first subname (or index in
+ // the case where there are no subnames) and append it to the
+ // base name.
+ if (forceSubnames)
+ print.name = base + (havesub ? subnames[0] : to_string(0));
print.value = vec[0];
print(stream);
return;
print.separatorString = info.separatorString;
print.descriptions = descriptions;
print.precision = info.precision;
+ print.forceSubnames = true;
if (!info.subnames.empty()) {
for (off_type i = 0; i < info.x; ++i)
}
VResult tot_vec(info.y);
- Result super_total = 0.0;
+ VResult super_total(1, 0.0);
for (off_type i = 0; i < info.x; ++i) {
if (havesub && (i >= info.subnames.size() || info.subnames[i].empty()))
continue;
yvec[j] = info.cvec[iy + j];
tot_vec[j] += yvec[j];
total += yvec[j];
- super_total += yvec[j];
+ super_total[0] += yvec[j];
}
print.name = info.name + "_" +
print(*stream);
}
+ // Create a subname for printing the total
+ vector<string> total_subname;
+ total_subname.push_back("total");
+
if (info.flags.isSet(::Stats::total) && (info.x > 1)) {
print.name = info.name;
+ print.subnames = total_subname;
print.desc = info.desc;
- print.vec = tot_vec;
- print.total = super_total;
+ print.vec = super_total;
+ print.flags = print.flags & ~total;
print(*stream);
}
}