Move profiler command line to main, move key to external file, add register function

This commit is contained in:
2019-07-02 15:31:40 +02:00
parent 5452021ab7
commit bcb7f00f68
4 changed files with 41 additions and 22 deletions

View File

@@ -1,11 +1,9 @@
#include "profiler.hpp"
#include <iostream>
#include <sstream>
#include <iomanip>
using namespace std;
using std::string;
Profiler profiler;
@@ -19,22 +17,12 @@ void Profiler::reset()
calls.clear();
}
bool Profiler::command_line(const string &input)
void Profiler::print() const
{
if (input == "profiler_print")
for (auto it = this->calls.begin();it != this->calls.end();it++)
{
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;
}
return true;
ostringstream out;
out << left << setw(25) << it->first << right << setw(5) << it->second;
cout << out.str() << endl;
}
if (input == "profiler_reset")
{
this->reset();
return true;
}
return false;
}