fix the byte multiplier for /proc/meminfo values
Fix the byte multiplier for values being read from /proc/meminfo to use
1024 for kibibytes rather than 1000 for kilobytes as it represents
values in kibibytes.
Change-Id: Ib7c34ab9e944171918b626bca5efd2518202ed04
Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
diff --git a/health_metric_collection.cpp b/health_metric_collection.cpp
index 2aa0ea2..552a2c3 100644
--- a/health_metric_collection.cpp
+++ b/health_metric_collection.cpp
@@ -159,7 +159,8 @@
auto absoluteValue = memoryValues.at(config.subType);
auto memoryTotal = memoryValues.at(MetricIntf::SubType::memoryTotal);
double percentValue = (memoryTotal - absoluteValue) / memoryTotal * 100;
- absoluteValue = absoluteValue * 1000;
+ // Convert kB to Bytes
+ absoluteValue = absoluteValue * 1024;
debug("Memory Metric {SUBTYPE}: {VALUE}, {PERCENT}", "SUBTYPE",
std::to_underlying(config.subType), "VALUE", absoluteValue,
"PERCENT", percentValue);