MeVisLab Toolbox Reference
|
Base class for single and multi-threaded processor. More...
#include <mlPageRequestProcessorBase.h>
Classes | |
struct | PerThreadStorage |
Data this is available on a per-thread basis to cache things that are reused across PageRequest calls, e.g. 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 if multi-threading is supported. | |
void | removeCancelledRequests () override |
Removes all requests that are canceled and no longer needed. | |
ProcessingTimeLine & | getProcessingTimeLine () |
Get access to the processing time line. | |
ProcessingTimeLine::TimeLine * | getOverviewTimeLine () |
Get access to the overview time line (only if time line profiling is on) | |
void | enableTimeLineProfiling (bool flag) |
Enable/disable time line profiling. | |
bool | isTimeLineProfilingEnabled () const |
Returns if time line profiling is enabled. | |
int | getProcessingScope () const |
Return the current processing scope. | |
void | enterProcessingScope () override |
Enters a recursive processing scope (always called from main thread!) | |
void | leaveProcessingScope () override |
Leaves a recursive processing scope (always called from main thread!) | |
Public Member Functions inherited from ml::PageRequestProcessor | |
~PageRequestProcessor () override | |
Virtual destructor. | |
virtual void | addRootTileRequest (TileRequest *tileRequest)=0 |
Adds the root tileRequest that should be processed (the ownership stays with the caller). | |
virtual void | processAll ()=0 |
Processes all requests until the cursors have traversed the whole tree and the queue is empty. | |
virtual void | process (double timeBudget)=0 |
Process the requests for the given timeBudget given in seconds. | |
virtual bool | needsProcessing ()=0 |
Returns if the tile request needs some more processing. | |
virtual void | setNumWorkerThreads (std::size_t)=0 |
Set number of worker threads (available here even if subclasses may not support it) | |
virtual bool | processingWasSingleThreaded () const =0 |
Returns if the last request was processed single or multi-threaded. | |
Public Member Functions inherited from ml::PageRequestQueueInterface | |
virtual | ~PageRequestQueueInterface () |
Virtual destructor to get rid of warning. | |
virtual void | append (PageRequest *request)=0 |
Append PageRequest request which is ready for processing to the work queue. | |
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. | |
void | setupCurrentProcessingScope () |
helper | |
virtual void | handleErrorsInGUIThread () |
handle all errors that have been accumulated | |
void | terminateAllRequestsInGUIThread () |
terminate all requests | |
void | addNewCursor (PageRequestCursor *cursor) |
add the new cursor | |
virtual void | getAllPageRequestQueues (std::vector< std::deque< PageRequest * > * > &queues) |
get all page request queues (to be derived when there are more than the GUI queues) | |
UserThreadData * | getUserThreadData (PageRequest *request, PerThreadStorage &perThreadStorage) |
Gets or allocates the UserThreadData for the given request as part of the perThreadStorage. | |
Protected Attributes | |
Host * | _host |
optional pointer to the host | |
bool | _terminated |
flag if the calculation was terminated | |
int | _rootTileRequests |
the number of root tile requests, if this gets down to 0, we are done | |
std::vector< std::vector< PageRequestCursor * > > | _cursors |
The cursors that are handled by the producer thread, one list for each processing scope. | |
int | _processingScope |
the current processing scope (0 = BG tasks, 1 = normal get tile, >1 = recursive get tile | |
int | _producerProcessingScope |
the current cursor scope of the producer | |
int | _producerCursorCounter |
how many cursors the producer contains in all lists | |
int | _guiThreadRecursionCounter |
the recursion of the GUI thread (0 = outer entry) | |
ScopeStackEntry * | _currentScope |
the current scope pointer | |
std::vector< ScopeStackEntry > | _scopeStack |
Stack of processing scopes for performance reasons, we only grow this stack, we never shrink it. | |
TimeCounter | _progressUpdateTimer |
Timer used for progress update from GUI thread. | |
PerThreadStorage | _guiPerThreadStorage |
The per thread storage for the GUI thread. | |
Profiling | |
bool | _useTimeLineProfiling |
ProcessingTimeLine | _profile |
ProcessingTimeLine::TimeLine * | _guiThreadTimeLine |
ProcessingTimeLine::TimeLine * | _overviewTimeLine |
Additional Inherited Members | |
Static Public Member Functions inherited from ml::PageRequestProcessor | |
static void | enableTileRequestAllocationFailure (int count=1) |
Enables failing on every count allocation. | |
static void | disableTileRequestAllocationFailure () |
Disables allocation failure (default!) | |
Base class for single and multi-threaded processor.
Definition at line 35 of file mlPageRequestProcessorBase.h.
ml::PageRequestProcessorBase::PageRequestProcessorBase | ( | Host * | host | ) |
|
override |
|
protected |
add the new cursor
|
protected |
Creates more work items, returns true if new work was created.
Enable/disable time line profiling.
|
overridevirtual |
Enters a recursive processing scope (always called from main thread!)
Implements ml::PageRequestProcessor.
|
protectedvirtual |
get all page request queues (to be derived when there are more than the GUI queues)
|
inline |
Get access to the overview time line (only if time line profiling is on)
Definition at line 53 of file mlPageRequestProcessorBase.h.
|
inline |
Return the current processing scope.
Definition at line 62 of file mlPageRequestProcessorBase.h.
|
inline |
Get access to the processing time line.
Definition at line 50 of file mlPageRequestProcessorBase.h.
|
protected |
Gets or allocates the UserThreadData for the given request as part of the perThreadStorage.
handle all errors that have been accumulated
|
inline |
Returns if time line profiling is enabled.
Definition at line 59 of file mlPageRequestProcessorBase.h.
|
overridevirtual |
Leaves a recursive processing scope (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 in not allowed at that point in time.
Implements ml::PageRequestProcessor.
|
protected |
helper
Returns if multi-threading is supported.
Implemented in ml::MultiThreadedPageRequestProcessor, and ml::SingleThreadedPageRequestProcessor.
|
protected |
terminate 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 if the calculation was terminated
Definition at line 93 of file mlPageRequestProcessorBase.h.
|
protected |
Definition at line 104 of file mlPageRequestProcessorBase.h.