From 85e9af42897a00784de72eba0f5568306208a08a Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 13 Sep 2020 08:14:41 +0200 Subject: [PATCH] make rate of periodic statistics configurable (closes #273) --- include/villas/super_node.hpp | 1 + lib/super_node.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/villas/super_node.hpp b/include/villas/super_node.hpp index 8e3ed7ffb..e64b855c1 100644 --- a/include/villas/super_node.hpp +++ b/include/villas/super_node.hpp @@ -73,6 +73,7 @@ protected: int priority; /**< Process priority (lower is better) */ int affinity; /**< Process affinity of the server and all created threads */ int hugepages; /**< Number of hugepages to reserve. */ + double statsRate; /**< Rate at which we display the periodic stats. */ struct Task task; /**< Task for periodic stats output */ diff --git a/lib/super_node.cpp b/lib/super_node.cpp index 4da961480..b86018f8b 100644 --- a/lib/super_node.cpp +++ b/lib/super_node.cpp @@ -62,6 +62,7 @@ SuperNode::SuperNode() : priority(0), affinity(0), hugepages(DEFAULT_NR_HUGEPAGES), + statsRate(1.0), task(CLOCK_REALTIME) { int ret; @@ -111,7 +112,8 @@ void SuperNode::parse(json_t *root) json_error_t err; - ret = json_unpack_ex(root, &err, 0, "{ s?: o, s?: o, s?: o, s?: o, s?: i, s?: i, s?: i, s?: s, s?: b }", + ret = json_unpack_ex(root, &err, 0, "{ s?: F, s?: o, s?: o, s?: o, s?: o, s?: i, s?: i, s?: i, s?: s, s?: b }", + "stats", &statsRate, "http", &json_http, "logging", &json_logging, "nodes", &json_nodes, @@ -386,7 +388,8 @@ void SuperNode::start() startNodes(); startPaths(); - task.setRate(1.0); + if (statsRate > 0) // A rate <0 will disable the periodic stats + task.setRate(statsRate); Stats::printHeader(Stats::Format::HUMAN);