Add some round-robin to the task processing, so equal priority
(auto) tasks won't always be scheduled, if there are multiple
tasks with the same priority.
Change-Id: Ice111aa5f85e9181b3ee9799ca4df0d58f210fe9
Don't account the to-be invoked task before invoking it.
If it happens to be restarted, account it and eventually lower
the system timer timeout.
Change-Id: I567e3b92c6c2999ce51aecb31f858e51cab6c999
While the stack removes all invoked tasks from the queue, which
actively removes it from scheduling, it also helps to faster handle
nested calls, as we don't have to look for the previous position
to move the task to the end of the queue for the round robin.
Change-Id: I358cf2492e9630f67685a2b780509edb56691830
When (re-)starting the system timer for new task, we have to take
the already passed time into account to correctly set the new
timeout time for the system timer.
Change-Id: I1c1c61b3e54bd14d9451c53150251534b2a960f0
Idles are just instant timers, which should most time have a low
priority, By dropping most special idle handling we'll just
schedule by priority.
This also reverts SalYieldResult back to a bool, which just
indicates if any event was processed.
Change-Id: Ia0b91b06dffb77af066f01838d8f9483523bf67d
The scheduler modifies the SchedulerData list mainly in two ways:
1. Remove a finished item
2. Append a new item
This optimizes the Append operation by keeping a last element
pointer, so we don't have to walk the whole list to find it. This
way this list is converted to a queue-like structure.
Change-Id: If7214e1f6016414551abbef11f26f332737f7893
Merges ImplSchedulerData::Invoke() into ProcessTaskScheduling()
and removes indention levels in CalculateMinimumTimeout by using
goto. This is straight forward.
Change-Id: I740b97315df92f8b979089e7e22058e628f95bc0
Move all Scheduler members of ImplSVData into ImplSchedulerContext
and make ImplSchedulerContext a member of ImplSVData.
Change-Id: I186bebdfb5701543595848968235b5a56b6598e9
1. calling Start() for invoked tasks
2. correctly schedule by priority
3. self-stopping AutoTimer
This also adds SAL_INFO output to Scheduler and Task to log the
scheduling processing tasks.
Change-Id: I3c8a708d1fd51c550320f8af3f9486c43c32e358
to markup dtors that coverity warns might throw exceptions
which won't throw in practice, or where std::terminate is
an acceptable response if they do
Change-Id: I32b94814e8245372e1d1dc36be0d81e3564042f4
Reviewed-on: https://gerrit.libreoffice.org/38318
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Moves all the "task-specific" stuff into a Task class and just
keeps the "real" static Scheduler functions in the original
Scheduler class.
Change-Id: I9eb02d46e2bcf1abb06af5bab1fa0ee734d1984c
All other places already refer to being Idle, so change the
Scheduler::ProcessTaskScheduling argument to bIdle and adapt
all other scheduler-related functions.
Change-Id: If5a605abbc3e620092127b65ada29f11215a0343
the bug here was that we had, on the stack, going into the scheduler
THREE times. Two of those were idles.
The original code would end up always picking the first idle from inside
ImplSchedulerData::GetMostImportantTask
and then
ImplSchedulerData::Invoke
would just return because we were still inside that Idle, and the second
Idle would never get executed
Since the second Idle was responsible for painting the dialog in the
bug, sometimes the dialog would never get painted.
Change-Id: Ia15b98a06e231c8e1c29450e05a76ad427e41e36
Reviewed-on: https://gerrit.libreoffice.org/31785
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins <ci@libreoffice.org>
Low priority idles can fire more or less randomly, and consequently two
consequent runs of LibreOffice differ in the amount of the idles that have
been performed during an operation.
This commit adds a possibility to turn on a 'deterministic mode' where two
subsequent runs of LibreOffice trigger about the same amount of events when
they perform the same set of operations.
Change-Id: I92566ef4eee20e7d604cfd48f01c4df30c77e653
The idea here is that we should process 'idle' events - like re-paint
after we have processed any OS messages - such as key/mouse input,
window re-size events etc.
The previous approach wasn't achieving this - it was processing a single
idle event each time around the main-loop iteration; urk.
Lubos implemented something -like- this, the vestiges of it need cleaning
up and removing in: 06d731428e but it was
disabled (most likely because it broke gtk in tdf#91727, which was itself
broken by using silly values for timeouts in the scheduler (now fixed))
Tested on Windows, gtk, kde4, unx-generic.
Change-Id: I7756bca874779c00f72b372cacb7745d0f189f66
Reviewed-on: https://gerrit.libreoffice.org/20158
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
This moves us towards unifying timeouts, events, idle handlers leaving
only the OS main-loop integration in the backends.
Change-Id: Iebfb0db21777d8018b33f216b13acb4ea2068659
When running CppunitTest_sc_macros_test in DrMemory, numerous
unaddressable accesses from SalTimerProc are reported.
During DeInitVCL(), ImplSalStopTimer() shuts down the TimerQueue, but
then the problem is that some disposing of some sidebar related UNO
service ends up calling Window::dispose() and Window::Hide() and
Window::ImplPostPaint(), which starts an Idle job maPaintIdle
that then re-starts the Win32 TimerQueue.
Change-Id: Ie1ab14330b6f1002c12d5302bb19f2b3f4c3811d
Regression from commit 6d64d2f38d (Minor
refactoring and cleanup of Scheduler and Timer., 2015-07-19), the old
Timer::ImplStartTimer() used to set nMS to at least 1, but the new
Scheduler::ImplStartTimer() didn't do that.
With this, JunitTest_sw_unoapi_3 no longer hangs for me.
Change-Id: I16ad360f1e5430cde7ec8b28e8c2620d260c9ec0
Members are now const-correct.
Replaced compile-time constants with enum.
Refactored common functions from Timer to Scheduler.
Disabled timer-precision unittests as they misfire often.
These changes are non-functional.
Change-Id: I6bb3d9fc402cadd556d9063ed9a4888f114c73d7
Reviewed-on: https://gerrit.libreoffice.org/17977
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
The periodic timers fire when the current time exceeds the
start time + the period. However, without reseting the start
time, the timer would end up thinking it must fire immediatly.
By reseting the start time when firing, the timer will
only fire again when another period has expired, not immediatly.
Change-Id: Ibd0311b12a514bfd558c0bd6ef83df8c89fd8c7e
Reviewed-on: https://gerrit.libreoffice.org/17194
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Re-factor the scheduler to use std::list
Because
- ImplSchedulerData
- remove: mbInScheduler, mnUpdateTime, mnUpdateStack
that is scheduler stuff
- this struct is only a container for the scheduler-list
- UpdateMinPeriod
- the scheduler is the pure-virtual-class then
the idle-class must override this method
- ImplDeInitScheduler(bool All=true)
- this patch 2e29a518b0 remove
all scheduler tasks and the scheduler, but after that,
the scheduler is using, then crash.
With this fix, only delete the scheduler-list, but not the
scheduler
The next steps
- split the scheduler from the scheduler-list-handling
the scheduler-list-handling need a static class
- remove the scheduler from the timer-handling staff
Change-Id: I8d4d4f27b2bc9684a48c2afafd0b3edd0716c71d
Reviewed-on: https://gerrit.libreoffice.org/16148
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
This clobbers the functionality from commit:
06d731428e
make idle timers actually activate only when idle
Since now all rendering and re-sizing is done in idle handlers it
does effectively the opposite of what was intended. A better solution
would allow special-casing the processing of just rendering,
re-sizing and window management to spin for eg. progress bar
rendering.
Also add helpful debugging labels to the idle & timeouts.
Also cleanup the Idle vs. Scheduler handling.
Also ensure that starting an Idle triggers a mainloop wakeup.
Also add a unit test.
Change-Id: Ifb0756714378fdb790be599b93c7a3ac1f9209e6