basic version of profiler class
This commit is contained in:
28
ml_profiler.h
Normal file
28
ml_profiler.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "ml.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
class MlPerfMon {
|
||||
|
||||
private:
|
||||
MlPerfMon() : perfOn(false) {};
|
||||
|
||||
public:
|
||||
|
||||
// https://stackoverflow.com/questions/43523509/simple-singleton-example-in-c
|
||||
static MlPerfMon& instance(){
|
||||
static MlPerfMon instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void turnOn();
|
||||
|
||||
void add_method_call(const std::string &method);
|
||||
void print_results();
|
||||
|
||||
private:
|
||||
bool perfOn;
|
||||
std::unordered_map<std::string, long> calls_counter;
|
||||
};
|
||||
Reference in New Issue
Block a user