Mercurial > hg > orthanc
diff OrthancFramework/Sources/MetricsRegistry.h @ 5326:fbe857e942cd
store metrics as integers instead of floats to avoid precision loss in increments
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sun, 25 Jun 2023 18:28:49 +0200 |
parents | 9c00e832985f |
children | dd9795dc380d |
line wrap: on
line diff
--- a/OrthancFramework/Sources/MetricsRegistry.h Sun Jun 25 17:49:34 2023 +0200 +++ b/OrthancFramework/Sources/MetricsRegistry.h Sun Jun 25 18:28:49 2023 +0200 @@ -35,6 +35,7 @@ #include <boost/thread/mutex.hpp> #include <boost/date_time/posix_time/posix_time.hpp> +#include <stdint.h> namespace Orthanc { @@ -75,17 +76,17 @@ MetricsType type); void SetValue(const std::string& name, - float value, + int64_t value, MetricsType type); void SetValue(const std::string& name, - float value) + int64_t value) { SetValue(name, value, MetricsType_Default); } void IncrementValue(const std::string& name, - float delta); + int64_t delta); MetricsType GetMetricsType(const std::string& name); @@ -99,14 +100,14 @@ boost::mutex mutex_; MetricsRegistry& registry_; std::string name_; - float value_; + int64_t value_; public: SharedMetrics(MetricsRegistry& registry, const std::string& name, MetricsType type); - void Add(float delta); + void Add(int64_t delta); };