]> git.tdb.fi Git - libs/core.git/blobdiff - source/debug/profiler.h
Use nullptr instead of 0 for pointers
[libs/core.git] / source / debug / profiler.h
index 7a82c5631899699cb42d04773bbf6e4c9ec5b4e9..22d2c9a82c9fcb7df8545d16e7545d9ebb0720a3 100644 (file)
@@ -4,6 +4,7 @@
 #include <map>
 #include <string>
 #include <vector>
+#include <msp/core/noncopyable.h>
 #include <msp/time/timedelta.h>
 #include <msp/time/timestamp.h>
 
@@ -24,7 +25,7 @@ profiled.
 Note: This is not thread-safe.  To profile multiple threads, create a separate
 Profiler for each thread.
 */
-class Profiler
+class Profiler: private NonCopyable
 {
 public:
        struct CallInfo
@@ -36,27 +37,23 @@ public:
        struct ScopeInfo
        {
                Time::TimeStamp first_call;
-               unsigned calls;
+               unsigned calls = 0;
                Time::TimeDelta total_time;
                Time::TimeDelta self_time;
                Time::TimeDelta avg_time;
-               float calls_per_sec;
+               float calls_per_sec = 0;
                std::vector<CallInfo> history;
-               unsigned hist_pos;
-               bool hist_full;
+               unsigned hist_pos = 0;
+               bool hist_full = false;
                std::map<std::string, unsigned> called_from;
-
-               ScopeInfo();
        };
 
 private:
-       unsigned period;
+       unsigned period = 0;
        std::map<std::string, ScopeInfo> scopes;
-       ProfilingScope *inner;
+       ProfilingScope *inner = nullptr;
 
 public:
-       Profiler();
-
        /** Sets the averaging period for timing data, measured in calls.  Previous
        average timings are cleared. */
        void set_period(unsigned p);