diff --git a/include/Profiling.h b/include/Profiling.h index 0ed5406..ad3e76b 100644 --- a/include/Profiling.h +++ b/include/Profiling.h @@ -22,6 +22,7 @@ struct Stats { double min; double max; size_t n; + size_t total_calls; }; /// Calculates and stores the moving average over K samples of execution time data @@ -41,6 +42,7 @@ struct UnitExecutionTime { private: boost::synchronized_value> m_measurements; + size_t m_total_calls {}; }; /// Holds profiles for multiple units by name. Threadsafe. diff --git a/src/Profiling.cpp b/src/Profiling.cpp index ab21bf4..1e17992 100644 --- a/src/Profiling.cpp +++ b/src/Profiling.cpp @@ -52,11 +52,13 @@ prof::Stats prof::UnitExecutionTime::stats() const { result.stddev += std::pow(measurement.count() - result.mean, 2); } result.stddev = std::sqrt(result.stddev / double(measurements->size())); + result.total_calls = m_total_calls; return result; } void prof::UnitExecutionTime::add_sample(const Duration& dur) { m_measurements->push_back(dur); + ++m_total_calls; } prof::UnitExecutionTime::UnitExecutionTime() diff --git a/src/TLuaEngine.cpp b/src/TLuaEngine.cpp index 059eca0..298c352 100644 --- a/src/TLuaEngine.cpp +++ b/src/TLuaEngine.cpp @@ -860,6 +860,7 @@ TLuaEngine::StateThreadData::StateThreadData(const std::string& Name, TLuaStateI Result[name]["min"] = stat.min; Result[name]["max"] = stat.max; Result[name]["n"] = stat.n; + Result[name]["total_calls"] = stat.total_calls; } return Result; });