[Libreoffice-commits] online.git: loolwsd/Admin.cpp loolwsd/Admin.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Sat Apr 30 14:36:23 UTC 2016
loolwsd/Admin.cpp | 9 +++++++--
loolwsd/Admin.hpp | 12 +++++++-----
2 files changed, 14 insertions(+), 7 deletions(-)
New commits:
commit fc9df5db917b7032927f8ba4bcc0d84c8be5f195
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Fri Apr 29 21:59:13 2016 -0400
loolwsd: don't log memory usage if not changed
Change-Id: I98c43abb87e2291a304e77d6eb09ea1800545b72
Reviewed-on: https://gerrit.libreoffice.org/24524
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/Admin.cpp b/loolwsd/Admin.cpp
index e246495..1441811 100644
--- a/loolwsd/Admin.cpp
+++ b/loolwsd/Admin.cpp
@@ -360,9 +360,14 @@ void MemoryStats::run()
{
std::unique_lock<std::mutex> modelLock(_admin->getLock());
AdminModel& model = _admin->getModel();
- unsigned totalMem = _admin->getTotalMemoryUsage(model);
+ const auto totalMem = _admin->getTotalMemoryUsage(model);
- Log::trace("Total memory used: " + std::to_string(totalMem));
+ if (totalMem != _lastTotalMemory)
+ {
+ Log::trace("Total memory used: " + std::to_string(totalMem));
+ }
+
+ _lastTotalMemory = totalMem;
model.addMemStats(totalMem);
}
diff --git a/loolwsd/Admin.hpp b/loolwsd/Admin.hpp
index f315efa..6ef3ad5 100644
--- a/loolwsd/Admin.hpp
+++ b/loolwsd/Admin.hpp
@@ -107,20 +107,22 @@ class MemoryStats : public Poco::Util::TimerTask
{
public:
MemoryStats(Admin* admin)
- : _admin(admin)
+ : _admin(admin),
+ _lastTotalMemory(0)
{
- Log::info("Memory stat ctor");
+ Log::debug("Memory stat ctor");
}
~MemoryStats()
{
- Log::info("Memory stat dtor");
+ Log::debug("Memory stat dtor");
}
void run() override;
private:
Admin* _admin;
+ long _lastTotalMemory;
};
class CpuStats : public Poco::Util::TimerTask
@@ -128,12 +130,12 @@ class CpuStats : public Poco::Util::TimerTask
public:
CpuStats(Admin* /*admin*/)
{
- Log::info("Cpu stat ctor");
+ Log::debug("Cpu stat ctor");
}
~CpuStats()
{
- Log::info("Cpu stat dtor");
+ Log::debug("Cpu stat dtor");
}
void run() override;
More information about the Libreoffice-commits
mailing list