Use configured bind_address for HTTPFetch
[oweals/minetest.git] / src / profiler.h
index b703a2d5b03fe489776c3bae3bb03c3bc0b9e88c..25d89c6c8a6304fd77988ab50fc01189c0f5c5b3 100644 (file)
@@ -22,9 +22,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "irrlichttypes.h"
 #include <string>
+#include <map>
+
 #include "jthread/jmutex.h"
 #include "jthread/jmutexautolock.h"
-#include <map>
 #include "util/timetaker.h"
 #include "util/numeric.h" // paging()
 #include "debug.h" // assert()
@@ -73,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;
                        }
                }
                {
@@ -164,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<std::string, float> m_data;