[Libreoffice-commits] core.git: Branch 'feature/fixes22' - 2 commits - include/vcl vcl/source
Jan Holesovsky
kendy at collabora.com
Mon May 30 15:59:07 UTC 2016
include/vcl/scheduler.hxx | 9 ++++++++-
vcl/source/app/idle.cxx | 27 ++++++++++++++++++++++++++-
vcl/source/app/scheduler.cxx | 12 ++++++++++++
3 files changed, 46 insertions(+), 2 deletions(-)
New commits:
commit 7780f96c345c61fff767696a599b2ecd963209d7
Author: Jan Holesovsky <kendy at collabora.com>
Date: Mon May 30 17:57:10 2016 +0200
Switch deterministic scheduling on.
Change-Id: Ie735d6456086933eb84a6088782ee55f1c1ef185
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index efb65ca..3f7e0bf6 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -174,7 +174,7 @@ bool Scheduler::ProcessTaskScheduling( bool bTimerOnly )
return false;
}
-static bool g_bDeterministicMode = false;
+static bool g_bDeterministicMode = true;
void Scheduler::SetDeterministicMode(bool bDeterministic)
{
commit 293dd3660bb7a9154ce602ee644f9605c5313961
Author: Jan Holesovsky <kendy at collabora.com>
Date: Mon May 30 17:36:37 2016 +0200
tdf#100092: Implement deterministic scheduling.
With this, two subsequent runs of LibreOffice trigger about the same amount of
events.
Change-Id: I92566ef4eee20e7d604cfd48f01c4df30c77e653
diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx
index 95303ee..ee83c1e 100644
--- a/include/vcl/scheduler.hxx
+++ b/include/vcl/scheduler.hxx
@@ -53,6 +53,7 @@ protected:
// These should be constexpr static, when supported.
static const sal_uInt64 ImmediateTimeoutMs = 1;
static const sal_uInt64 MaximumTimeoutMs = 1000 * 60; // 1 minute
+ static const sal_uInt64 InfiniteTimeoutMs = 1000 * 60 * 60 * 24; // 1 day
static void ImplStartTimer(sal_uInt64 nMS, bool bForce = false);
@@ -90,7 +91,7 @@ public:
Scheduler& operator=( const Scheduler& rScheduler );
static void ImplDeInitScheduler();
- // Process one pending Timer with highhest priority
+ /// Process one pending Timer with highhest priority
static void CallbackTaskScheduling( bool ignore );
/// Calculate minimum timeout - and return its value.
static sal_uInt64 CalculateMinimumTimeout( bool &bHasActiveIdles );
@@ -98,6 +99,12 @@ public:
static bool ProcessTaskScheduling( bool bTimerOnly );
/// Process all events until we are idle
static void ProcessEventsToIdle();
+
+ /// Control the deterministic mode. In this mode, two subsequent runs of
+ /// LibreOffice fire about the same amount idles.
+ static void SetDeterministicMode(bool bDeterministic);
+ /// Return the current state of deterministic mode.
+ static bool GetDeterministicMode();
};
#endif // INCLUDED_VCL_SCHEDULER_HXX
diff --git a/vcl/source/app/idle.cxx b/vcl/source/app/idle.cxx
index 123f37a..587e05f 100644
--- a/vcl/source/app/idle.cxx
+++ b/vcl/source/app/idle.cxx
@@ -44,7 +44,23 @@ Idle::Idle( const Idle& rIdle ) : Scheduler(rIdle)
void Idle::Start()
{
Scheduler::Start();
- Scheduler::ImplStartTimer(Scheduler::ImmediateTimeoutMs);
+
+ sal_uInt64 nPeriod = Scheduler::ImmediateTimeoutMs;
+ if (Scheduler::GetDeterministicMode())
+ {
+ switch (mePriority)
+ {
+ case SchedulerPriority::LOW:
+ case SchedulerPriority::LOWER:
+ case SchedulerPriority::LOWEST:
+ nPeriod = Scheduler::InfiniteTimeoutMs;
+ break;
+ default:
+ break;
+ }
+ }
+
+ Scheduler::ImplStartTimer(nPeriod);
}
bool Idle::ReadyForSchedule( bool bTimerOnly, sal_uInt64 /* nTimeNow */ ) const
@@ -67,6 +83,15 @@ sal_uInt64 Idle::UpdateMinPeriod( sal_uInt64 nMinPeriod, sal_uInt64 /* nTime */
case SchedulerPriority::REPAINT:
nMinPeriod = ImmediateTimeoutMs; // don't wait.
break;
+ case SchedulerPriority::LOW:
+ case SchedulerPriority::LOWER:
+ case SchedulerPriority::LOWEST:
+ if (Scheduler::GetDeterministicMode())
+ {
+ nMinPeriod = Scheduler::InfiniteTimeoutMs;
+ break;
+ }
+ // fall-through intended
default:
// FIXME: tdf#92036 workaround, I should be 1 too - wait 5ms
if (nMinPeriod > 5) // only shrink the min. period if nothing is quicker.
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 879ca42..efb65ca 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -174,6 +174,18 @@ bool Scheduler::ProcessTaskScheduling( bool bTimerOnly )
return false;
}
+static bool g_bDeterministicMode = false;
+
+void Scheduler::SetDeterministicMode(bool bDeterministic)
+{
+ g_bDeterministicMode = bDeterministic;
+}
+
+bool Scheduler::GetDeterministicMode()
+{
+ return g_bDeterministicMode;
+}
+
sal_uInt64 Scheduler::CalculateMinimumTimeout( bool &bHasActiveIdles )
{
// process all pending Tasks
More information about the Libreoffice-commits
mailing list