29 lines
473 B
C++
29 lines
473 B
C++
#include "profiler.hpp"
|
|
|
|
#include <iostream>
|
|
#include <iomanip>
|
|
|
|
using namespace std;
|
|
|
|
Profiler profiler;
|
|
|
|
void Profiler::record_function_call(const char *function_name)
|
|
{
|
|
calls[function_name]++;
|
|
}
|
|
|
|
void Profiler::reset()
|
|
{
|
|
calls.clear();
|
|
}
|
|
|
|
void Profiler::print() const
|
|
{
|
|
for (auto it = this->calls.begin();it != this->calls.end();it++)
|
|
{
|
|
ostringstream out;
|
|
out << left << setw(25) << it->first << right << setw(5) << it->second;
|
|
cout << out.str() << endl;
|
|
}
|
|
}
|