LibreOffice Module vcl (master) 1
|
Helper class primary used to track time of long running iterating tasks. More...
#include <TaskStopwatch.hxx>
Public Member Functions | |
TaskStopwatch (bool bConciderLastIterTime=true) | |
Per default the watch considers the last iter time when asking for an other iteration, so considers Scheduler::acceptableTaskTime as a maximum value. More... | |
bool | continueIter () |
Returns true, if another iteration will probably pass in the time slot. More... | |
void | reset () |
Reset the stopwatch. More... | |
void | setInputStop (VclInputFlags eInputStop=eDefaultInputStop) |
Sets the input events, which should also "exceed" the stopwatch. More... | |
VclInputFlags | inputStop () const |
Static Public Member Functions | |
static unsigned int | timeSlice () |
Sets the time considered the acceptable maximum for a task to run. More... | |
static void | setTimeSlice (unsigned int nTimeSlice) |
Private Member Functions | |
bool | nextIter () |
Private Attributes | |
sal_uInt64 | m_nStartTicks |
sal_uInt64 | m_nIterStartTicks |
bool | m_bConsiderLastIterTime |
VclInputFlags | m_eInputStop |
Static Private Attributes | |
static constexpr VclInputFlags | eDefaultInputStop = VCL_INPUT_ANY & ~VclInputFlags::TIMER |
static constexpr unsigned int | nDefaultTimeSlice = 50 |
static unsigned int | m_nTimeSlice = TaskStopwatch::nDefaultTimeSlice |
Helper class primary used to track time of long running iterating tasks.
Normally it should be sufficient to instantiate the watch object before starting the iteration and query continueIter() at the end of each.
Called Stopwatch, because there is already a Timer class in the Scheduler.
TODO: merge into the general Scheduler, so this can also be used to track Task runtimes in a more general way. TODO: handle fast iterations, where continueIter is called multiple times per tick, by counting the iterations per tick and use that for approximation.
Definition at line 31 of file TaskStopwatch.hxx.
|
inline |
Per default the watch considers the last iter time when asking for an other iteration, so considers Scheduler::acceptableTaskTime as a maximum value.
If you already know your iter time vary in a large range, consider setting bConciderLastIterTime to false, so Scheduler::acceptableTaskTime will be used as a minimum time slot.
Definition at line 75 of file TaskStopwatch.hxx.
References Time.
|
inline |
Returns true, if another iteration will probably pass in the time slot.
Definition at line 86 of file TaskStopwatch.hxx.
|
inline |
Definition at line 103 of file TaskStopwatch.hxx.
|
inlineprivate |
Definition at line 42 of file TaskStopwatch.hxx.
References Application::AnyInput(), and tools::Time::GetSystemTicks().
|
inline |
Reset the stopwatch.
Definition at line 91 of file TaskStopwatch.hxx.
References tools::Time::GetSystemTicks().
|
inline |
Sets the input events, which should also "exceed" the stopwatch.
Per default this ignores the VclInputFlags::TIMER.
Definition at line 102 of file TaskStopwatch.hxx.
|
inlinestatic |
Definition at line 112 of file TaskStopwatch.hxx.
|
inlinestatic |
Sets the time considered the acceptable maximum for a task to run.
This is an orientation for long time background jobs to yield to the scheduler, so Idle task don't starve each other too much.
Definition at line 111 of file TaskStopwatch.hxx.
|
staticconstexprprivate |
Definition at line 33 of file TaskStopwatch.hxx.
|
private |
Definition at line 39 of file TaskStopwatch.hxx.
|
private |
Definition at line 40 of file TaskStopwatch.hxx.
|
private |
Definition at line 38 of file TaskStopwatch.hxx.
|
private |
Definition at line 37 of file TaskStopwatch.hxx.
|
staticprivate |
Definition at line 35 of file TaskStopwatch.hxx.
|
staticconstexprprivate |
Definition at line 34 of file TaskStopwatch.hxx.