MeVisLab Toolbox Reference
|
Base class for single and multithreaded processor. More...
#include <mlPageRequestProcessorBase.h>
Classes | |
struct | PerThreadStorage |
Data that is available on a per-thread basis to cache items that are reused across PageRequest calls, e.g., the UserThreadData. More... | |
struct | ScopeStackEntry |
Each processing scope has its own GUI work queue and flags/counters for errors and tiles to wait for. More... | |
Public Member Functions | |
PageRequestProcessorBase (Host *host) | |
~PageRequestProcessorBase () override | |
virtual bool | supportsMultiThreading ()=0 |
Returns whether multithreading is supported. More... | |
void | removeCancelledRequests () override |
Removes all requests that are canceled and no longer needed. More... | |
ProcessingTimeLine & | getProcessingTimeLine () |
Returns access to the processing timeline. More... | |
ProcessingTimeLine::TimeLine * | getOverviewTimeLine () |
Returns access to the overview timeline (only if timeline profiling is on). More... | |
void | enableTimeLineProfiling (bool flag) |
Enables/disables timeline profiling. More... | |
bool | isTimeLineProfilingEnabled () const |
Returns whether timeline profiling is enabled. More... | |
int | getProcessingScope () const |
Returns the current processing scope. More... | |
void | enterProcessingScope () override |
Enters a recursive processing scope. This is always called from main thread! More... | |
void | leaveProcessingScope () override |
Leaves a recursive processing scope. This is always called from main thread! More... | |
![]() | |
~PageRequestProcessor () override | |
Virtual destructor. More... | |
virtual void | addRootTileRequest (TileRequest *tileRequest)=0 |
Adds the root tileRequest that should be processed; the ownership stays with the caller. More... | |
virtual void | processAll ()=0 |
Processes all requests until the cursors have traversed the whole tree and the queue is empty. More... | |
virtual void | process (double timeBudget)=0 |
Processes the requests for the given timeBudget given in seconds. More... | |
virtual bool | needsProcessing ()=0 |
Returns whether the tile request needs some more processing. More... | |
virtual void | setNumWorkerThreads (std::size_t)=0 |
Sets number of worker threads (available here even if subclasses may not support it). More... | |
virtual bool | processingWasSingleThreaded () const =0 |
Returns whether the last request was processed single or multithreaded. More... | |
![]() | |
virtual | ~PageRequestQueueInterface () |
Virtual destructor to get rid of warning. More... | |
virtual void | append (PageRequest *request)=0 |
Appends PageRequest request that is ready for processing to the work queue. More... | |
Protected Member Functions | |
bool | createMoreWork (bool sleepWhenBlocked, bool *allBlocked=nullptr, MLint pageRequestLimit=100000, MLint *resultPageRequestCount=nullptr) |
Creates more work items, returns true if new work was created. More... | |
void | setupCurrentProcessingScope () |
Helper. More... | |
virtual void | handleErrorsInGUIThread () |
Handles all errors that have been accumulated. More... | |
void | terminateAllRequestsInGUIThread () |
Terminates all requests. More... | |
void | addNewCursor (PageRequestCursor *cursor) |
Adds the new cursor. More... | |
virtual void | getAllPageRequestQueues (std::vector< std::deque< PageRequest * > * > &queues) |
Returns all page request queues (to be derived when there are more than the GUI queues). More... | |
UserThreadData * | getUserThreadData (PageRequest *request, PerThreadStorage &perThreadStorage) |
Returns or allocates the UserThreadData for the given request as part of the perThreadStorage. More... | |
Protected Attributes | |
Host * | _host |
Optional pointer to the host. More... | |
bool | _terminated |
Flag whether the calculation was terminated. More... | |
int | _rootTileRequests |
The number of root tile requests; if this gets down to 0, we are done. More... | |
std::vector< std::vector< PageRequestCursor * > > | _cursors |
The cursors that are handled by the producer thread, one list for each processing scope. More... | |
int | _processingScope |
The current processing scope (0 = BG tasks, 1 = normal get tile, >1 = recursive get tile). More... | |
int | _producerProcessingScope |
The current cursor scope of the producer. More... | |
int | _producerCursorCounter |
How many cursors the producer contains in all lists. More... | |
int | _guiThreadRecursionCounter |
The recursion of the GUI thread (0 = outer entry). More... | |
ScopeStackEntry * | _currentScope |
The current scope pointer. More... | |
std::vector< ScopeStackEntry > | _scopeStack |
Stack of processing scopes. More... | |
TimeCounter | _progressUpdateTimer |
Timer used for progress update from GUI thread. More... | |
PerThreadStorage | _guiPerThreadStorage |
The per-thread storage for the GUI thread. More... | |
Profiling | |
bool | _useTimeLineProfiling |
ProcessingTimeLine | _profile |
ProcessingTimeLine::TimeLine * | _guiThreadTimeLine |
ProcessingTimeLine::TimeLine * | _overviewTimeLine |
Additional Inherited Members | |
![]() | |
static void | enableTileRequestAllocationFailure (int count=1) |
Enables failing on every count allocation. More... | |
static void | disableTileRequestAllocationFailure () |
Disables allocation failure. This is the default! More... | |
Base class for single and multithreaded processor.
Definition at line 35 of file mlPageRequestProcessorBase.h.
ml::PageRequestProcessorBase::PageRequestProcessorBase | ( | Host * | host | ) |
|
override |
|
protected |
Adds the new cursor.
|
protected |
Creates more work items, returns true
if new work was created.
void ml::PageRequestProcessorBase::enableTimeLineProfiling | ( | bool | flag | ) |
Enables/disables timeline profiling.
|
overridevirtual |
Enters a recursive processing scope. This is always called from main thread!
Implements ml::PageRequestProcessor.
|
protectedvirtual |
Returns all page request queues (to be derived when there are more than the GUI queues).
|
inline |
Returns access to the overview timeline (only if timeline profiling is on).
Definition at line 53 of file mlPageRequestProcessorBase.h.
|
inline |
Returns the current processing scope.
Definition at line 62 of file mlPageRequestProcessorBase.h.
|
inline |
Returns access to the processing timeline.
Definition at line 50 of file mlPageRequestProcessorBase.h.
|
protected |
Returns or allocates the UserThreadData for the given request as part of the perThreadStorage.
|
protectedvirtual |
Handles all errors that have been accumulated.
|
inline |
Returns whether timeline profiling is enabled.
Definition at line 59 of file mlPageRequestProcessorBase.h.
|
overridevirtual |
Leaves a recursive processing scope. This is always called from main thread!
Implements ml::PageRequestProcessor.
|
overridevirtual |
Removes all requests that are canceled and no longer needed.
Make sure to only call this from the GUI thread AND when you know that processing by other threads is not allowed at that point in time.
Implements ml::PageRequestProcessor.
|
protected |
Helper.
|
pure virtual |
Returns whether multithreading is supported.
Implemented in ml::SingleThreadedPageRequestProcessor, and ml::MultiThreadedPageRequestProcessor.
|
protected |
Terminates all requests.
|
protected |
The current scope pointer.
Definition at line 141 of file mlPageRequestProcessorBase.h.
|
protected |
The cursors that are handled by the producer thread, one list for each processing scope.
Definition at line 100 of file mlPageRequestProcessorBase.h.
|
protected |
The per-thread storage for the GUI thread.
Definition at line 165 of file mlPageRequestProcessorBase.h.
|
protected |
The recursion of the GUI thread (0 = outer entry).
Definition at line 117 of file mlPageRequestProcessorBase.h.
|
protected |
Definition at line 106 of file mlPageRequestProcessorBase.h.
|
protected |
Optional pointer to the host.
Definition at line 90 of file mlPageRequestProcessorBase.h.
|
protected |
Definition at line 107 of file mlPageRequestProcessorBase.h.
|
protected |
The current processing scope (0 = BG tasks, 1 = normal get tile, >1 = recursive get tile).
Definition at line 111 of file mlPageRequestProcessorBase.h.
|
protected |
How many cursors the producer contains in all lists.
Definition at line 115 of file mlPageRequestProcessorBase.h.
|
protected |
The current cursor scope of the producer.
Definition at line 113 of file mlPageRequestProcessorBase.h.
|
protected |
Definition at line 105 of file mlPageRequestProcessorBase.h.
|
protected |
Timer used for progress update from GUI thread.
Definition at line 148 of file mlPageRequestProcessorBase.h.
|
protected |
The number of root tile requests; if this gets down to 0, we are done.
Definition at line 96 of file mlPageRequestProcessorBase.h.
|
protected |
Stack of processing scopes.
For performance reasons, we only grow this stack; we never shrink it.
Definition at line 145 of file mlPageRequestProcessorBase.h.
|
protected |
Flag whether the calculation was terminated.
Definition at line 93 of file mlPageRequestProcessorBase.h.
|
protected |
Definition at line 104 of file mlPageRequestProcessorBase.h.