1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-22 02:20:51 +03:00
mold/perf.cc
2020-12-10 22:32:47 +09:00

23 lines
469 B
C++

#include "mold.h"
#include <iomanip>
#include <ios>
using namespace llvm;
std::vector<Counter *> Counter::instances;
bool Counter::enabled = true;
void Counter::print() {
if (!enabled)
return;
std::vector<Counter *> vec = instances;
std::stable_sort(vec.begin(), vec.end(), [](Counter *a, Counter *b) {
return a->value > b->value;
});
for (Counter *c : vec)
std::cout << std::setw(20) << std::right << c->name << "=" << c->value << "\n";
}