Kaydet (Commit) c5721376 authored tarafından Ashod Nakashian's avatar Ashod Nakashian Kaydeden (comit) Michael Stahl

tdf#38837 Reduce power consumption by minimizing idle timers

Based on profiling, Writer's most CPU consuming idle event was
document statistics calculation.
This patch stops the idle timer once statistics has been updated.
Subsequent profiling shows a sharp decline in CPU usage.

Modifications to the document should initiate statistics update.

Change-Id: I8c38ad8847987264549945e4f482ea18d2635283
Reviewed-on: https://gerrit.libreoffice.org/14575Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
Tested-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst 23b0112e
...@@ -119,6 +119,8 @@ void DocumentStatisticsManager::UpdateDocStat( bool bCompleteAsync, bool bFields ...@@ -119,6 +119,8 @@ void DocumentStatisticsManager::UpdateDocStat( bool bCompleteAsync, bool bFields
} }
else if (IncrementalDocStatCalculate(5000, bFields)) else if (IncrementalDocStatCalculate(5000, bFields))
maStatsUpdateTimer.Start(); maStatsUpdateTimer.Start();
else
maStatsUpdateTimer.Stop();
} }
} }
...@@ -219,7 +221,7 @@ bool DocumentStatisticsManager::IncrementalDocStatCalculate(long nChars, bool bF ...@@ -219,7 +221,7 @@ bool DocumentStatisticsManager::IncrementalDocStatCalculate(long nChars, bool bF
pType->UpdateFlds(); pType->UpdateFlds();
} }
return nChars <= 0; return nChars < 0;
} }
IMPL_LINK( DocumentStatisticsManager, DoIdleStatsUpdate, Timer *, pTimer ) IMPL_LINK( DocumentStatisticsManager, DoIdleStatsUpdate, Timer *, pTimer )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment