1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-11 13:06:59 +03:00
mold/perf.cc

21 lines
446 B
C++
Raw Normal View History

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
}