loolwsd: don't log memory usage if not changed

Change-Id: I98c43abb87e2291a304e77d6eb09ea1800545b72
Reviewed-on: https://gerrit.libreoffice.org/24524
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
Ashod Nakashian 2016-04-29 21:59:13 -04:00 committed by Ashod Nakashian
parent 67fb02d277
commit fc9df5db91
2 changed files with 14 additions and 7 deletions

View file

@ -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);
}

View file

@ -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;