2020-11-03 11:26:42 +03:00
|
|
|
#include "mold.h"
|
|
|
|
|
2020-12-10 16:32:47 +03:00
|
|
|
#include <iomanip>
|
|
|
|
#include <ios>
|
|
|
|
|
2020-11-03 11:26:42 +03:00
|
|
|
std::vector<Counter *> Counter::instances;
|
|
|
|
bool Counter::enabled = true;
|
|
|
|
|
|
|
|
void Counter::print() {
|
|
|
|
if (!enabled)
|
|
|
|
return;
|
|
|
|
|
|
|
|
std::vector<Counter *> vec = instances;
|
2020-11-30 12:43:04 +03:00
|
|
|
std::stable_sort(vec.begin(), vec.end(), [](Counter *a, Counter *b) {
|
|
|
|
return a->value > b->value;
|
|
|
|
});
|
2020-11-03 11:26:42 +03:00
|
|
|
|
|
|
|
for (Counter *c : vec)
|
2020-12-10 16:32:47 +03:00
|
|
|
std::cout << std::setw(20) << std::right << c->name << "=" << c->value << "\n";
|
2020-11-03 11:26:42 +03:00
|
|
|
}
|