]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
Support for storing more than one samples
authorFranciszek Gorski <fagorski9@gmail.com>
Thu, 6 Jun 2019 17:28:30 +0000 (19:28 +0200)
committerRazvan Becheriu <razvan@isc.org>
Mon, 15 Jul 2019 12:25:13 +0000 (15:25 +0300)
src/lib/stats/observation.cc
src/lib/stats/observation.h

index de639e91e4ca3a1b362821bbcbe80bd70b7b707b..3e7417386a9efab49ab8a7c585d3b5ac9574fc55 100644 (file)
@@ -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;
index 0fa2b7f43956c44af138aa8aa95f85a5a599d27e..087eca91e0c5ad287b53e146058772db5951d311 100644 (file)
@@ -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<IntegerSample>)
+    /// @tparam StorageType type of storage (e.g. list<IntegerSample>)
     /// @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_;