diff options
author | Ashod Nakashian <ashodnakashian@yahoo.com> | 2015-02-21 19:07:37 -0500 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-02-26 16:00:30 +0000 |
commit | c57213764b387dddad946e78145cea607ca9f460 (patch) | |
tree | 09a2d5a72f80f0fb17d52bc08b93ec0f166bcc48 | |
parent | 23b0112ecea2f8796a4e237e9061de1a36997a30 (diff) |
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/14575
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | sw/source/core/doc/DocumentStatisticsManager.cxx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sw/source/core/doc/DocumentStatisticsManager.cxx b/sw/source/core/doc/DocumentStatisticsManager.cxx index 6f1d094e8a1f..989d548284b1 100644 --- a/sw/source/core/doc/DocumentStatisticsManager.cxx +++ b/sw/source/core/doc/DocumentStatisticsManager.cxx @@ -119,6 +119,8 @@ void DocumentStatisticsManager::UpdateDocStat( bool bCompleteAsync, bool bFields } else if (IncrementalDocStatCalculate(5000, bFields)) maStatsUpdateTimer.Start(); + else + maStatsUpdateTimer.Stop(); } } @@ -219,7 +221,7 @@ bool DocumentStatisticsManager::IncrementalDocStatCalculate(long nChars, bool bF pType->UpdateFlds(); } - return nChars <= 0; + return nChars < 0; } IMPL_LINK( DocumentStatisticsManager, DoIdleStatsUpdate, Timer *, pTimer ) |