10 #ifndef INCLUDED_VCL_TASK_STOPWATCH_HXX
11 #define INCLUDED_VCL_TASK_STOPWATCH_HXX
34 static constexpr
unsigned int nDefaultTimeSlice = 50;
46 if (nCurTicks < m_nStartTicks)
49 if (!bQueryOnly && m_bConsiderLastIterTime)
53 if (m_nTimeSlice < 2 * nCurTicks - m_nIterStartTicks - m_nStartTicks)
57 else if (m_nTimeSlice < nCurTicks - m_nStartTicks)
61 m_nIterStartTicks = nCurTicks;
77 : m_nStartTicks(
tools::
Time::GetSystemTicks())
78 , m_nIterStartTicks(m_nStartTicks)
79 , m_bConsiderLastIterTime(bConciderLastIterTime)
80 , m_eInputStop(eDefaultInputStop)
100 m_nIterStartTicks = m_nStartTicks;
117 static unsigned int timeSlice() {
return m_nTimeSlice; }
118 static void setTimeSlice(
unsigned int nTimeSlice) { m_nTimeSlice = nTimeSlice; }
121 #endif // INCLUDED_VCL_TASK_STOPWATCH_HXX
bool continueIter()
Returns true, if another iteration will probably pass in the time slot.
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.
void reset()
Reset the stopwatch.
VclInputFlags m_eInputStop
VclInputFlags inputStop() const
sal_uInt64 m_nIterStartTicks
bool m_bConsiderLastIterTime
static unsigned int m_nTimeSlice
static bool AnyInput(VclInputFlags nType=VCL_INPUT_ANY)
Determine if there are any pending input events.
static void setTimeSlice(unsigned int nTimeSlice)
bool nextIter(bool bQueryOnly)
bool exceededRuntime()
Returns true, if the time slot is already exceeded.
static unsigned int timeSlice()
Sets the time considered the acceptable maximum for a task to run.
Helper class primary used to track time of long running iterating tasks.
void setInputStop(VclInputFlags eInputStop=eDefaultInputStop)
Sets the input events, which should also "exceed" the stopwatch.