From: Franciszek Gorski Date: Thu, 6 Jun 2019 17:28:30 +0000 (+0200) Subject: Support for storing more than one samples X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35c84cf8276abb3f5f0d624ca493eec76052088b;p=thirdparty%2Fkea.git Support for storing more than one samples --- diff --git a/src/lib/stats/observation.cc b/src/lib/stats/observation.cc index de639e91e4..3e7417386a 100644 --- a/src/lib/stats/observation.cc +++ b/src/lib/stats/observation.cc @@ -188,7 +188,7 @@ void Observation::setValueInternal(SampleType value, StorageType& storage, storage.front().second - storage.back().second; // removing samples until the range_of_storage // stops exceeding the duration limit - while (range_of_storage > max_sample_age.second) { + while (range_of_storage >= max_sample_age.second) { storage.pop_back(); range_of_storage = storage.front().second - storage.back().second; @@ -317,8 +317,7 @@ std::string Observation::typeToText(Type type) { tmp << "integer"; break; case STAT_FLOAT: - tmp << "float"; - break; + tmp << "float"; break; case STAT_DURATION: tmp << "duration"; break; diff --git a/src/lib/stats/observation.h b/src/lib/stats/observation.h index 0fa2b7f439..087eca91e0 100644 --- a/src/lib/stats/observation.h +++ b/src/lib/stats/observation.h @@ -303,7 +303,7 @@ private: /// @brief Returns samples (internal version) /// /// @tparam SampleType type of samples (e.g. IntegerSample) - /// @tparam Storage type of storage (e.g. list) + /// @tparam StorageType type of storage (e.g. list) /// @param observation storage /// @param exp_type expected observation type (used for sanity checking) /// @throw InvalidStatType if observation type mismatches @@ -332,6 +332,7 @@ private: void setMaxSampleCountInternal(StorageType& storage, uint32_t max_samples, Type exp_type); + /// @brief Observation (statistic) name std::string name_;