callstack added
This commit is contained in:
@@ -3,10 +3,12 @@
|
||||
#include "ml.h"
|
||||
|
||||
#include <unordered_map>
|
||||
#include <deque>
|
||||
#include <chrono>
|
||||
|
||||
static const int method_name_print_len = 15;
|
||||
static const int print_top_methods = 15;
|
||||
static const int call_stack_max_methods = 10;
|
||||
|
||||
class MlPerfMon {
|
||||
|
||||
@@ -24,10 +26,13 @@ public:
|
||||
void turnOn();
|
||||
|
||||
void add_method_call(const std::string &method);
|
||||
void end_method_call();
|
||||
std::string callstack() const;
|
||||
void print_results();
|
||||
|
||||
private:
|
||||
bool perfOn;
|
||||
std::unordered_map<std::string, long> calls_counter;
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> start_time;
|
||||
std::deque<std::string> call_stack;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user