summaryrefslogtreecommitdiffstats
path: root/wsd/Admin.hpp
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2018-02-11 15:28:19 -0500
committerAshod Nakashian <ashnakash@gmail.com>2018-02-11 22:16:50 +0100
commit88619a323ffcd654432debf14b679f6d23bbb736 (patch)
tree79e49346a11a829a9fa871c327ec3f69ae6ae967 /wsd/Admin.hpp
parentut: log the test name for easier traceability (diff)
downloadonline-88619a323ffcd654432debf14b679f6d23bbb736.tar.gz
online-88619a323ffcd654432debf14b679f6d23bbb736.zip
wsd: reduce memory load only when the footprint changes
Update the network interval when updating the memory interval, since we currently don't support changing the network interval. Also make the default memory and network interval twice that of the cpu interval explicitly. Reduce logging noise a bit without losing information. And some const-correctness and other cleanups. Change-Id: I313fb2882675f560091e5113dbdcbdef269828e2 Reviewed-on: https://gerrit.libreoffice.org/49571 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'wsd/Admin.hpp')
-rw-r--r--wsd/Admin.hpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/wsd/Admin.hpp b/wsd/Admin.hpp
index 649f066188..e3386952ba 100644
--- a/wsd/Admin.hpp
+++ b/wsd/Admin.hpp
@@ -126,6 +126,14 @@ private:
/// under @hardModeLimit
void triggerMemoryCleanup(size_t hardModeLimit);
+ /// Round the interval up to multiples of MinStatsIntervalMs.
+ /// This is to avoid arbitrarily small intervals that hammer the server.
+ static int capAndRoundInterval(const unsigned interval)
+ {
+ const int value = std::max<int>(interval, MinStatsIntervalMs);
+ return ((value + MinStatsIntervalMs - 1) / MinStatsIntervalMs) * MinStatsIntervalMs;
+ }
+
private:
/// The model is accessed only during startup & in
/// the Admin Poll thread.
@@ -139,13 +147,14 @@ private:
size_t _totalSysMemKb;
size_t _totalAvailMemKb;
- std::atomic<int> _memStatsTaskIntervalMs;
std::atomic<int> _cpuStatsTaskIntervalMs;
- std::atomic<int> _networkStatsIntervalMs;
+ std::atomic<int> _memStatsTaskIntervalMs;
+ std::atomic<int> _netStatsTaskIntervalMs;
DocProcSettings _defDocProcSettings;
// Don't update any more frequently than this since it's excessive.
- const int MinStatsIntervalMs = 50;
+ static const int MinStatsIntervalMs = 50;
+ static const int DefStatsIntervalMs = 2500;
};
#endif