Move profiler command line to main, move key to external file, add register function
This commit is contained in:
22
profiler.cpp
22
profiler.cpp
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user