X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fprofiler.h;h=25d89c6c8a6304fd77988ab50fc01189c0f5c5b3;hb=8852333eb3042580592ade478e5def20f8ed5d4c;hp=e22a865c070bafce51a9e580cd2a7faa479d38a7;hpb=4e1f50035e860a00636ca5d804c267119df99601;p=oweals%2Fminetest.git diff --git a/src/profiler.h b/src/profiler.h index e22a865c0..25d89c6c8 100644 --- a/src/profiler.h +++ b/src/profiler.h @@ -22,9 +22,10 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "irrlichttypes.h" #include -#include -#include #include + +#include "jthread/jmutex.h" +#include "jthread/jmutexautolock.h" #include "util/timetaker.h" #include "util/numeric.h" // paging() #include "debug.h" // assert() @@ -38,7 +39,6 @@ class Profiler public: Profiler() { - m_mutex.Init(); } void add(const std::string &name, float value) @@ -74,7 +74,7 @@ public: else{ /* No add shall have been used */ assert(n->second != -2); - n->second = (std::max)(n->second, 0) + 1; + n->second = MYMAX(n->second, 0) + 1; } } { @@ -165,6 +165,13 @@ public: m_graphvalues.clear(); } + void remove(const std::string& name) + { + JMutexAutoLock lock(m_mutex); + m_avgcounts.erase(name); + m_data.erase(name); + } + private: JMutex m_mutex; std::map m_data;