MeVisLab Toolbox Reference
ml::PageRequestProcessorBase Class Referenceabstract

Base class for single and multithreaded processor. More...

#include <mlPageRequestProcessorBase.h>

Inheritance diagram for ml::PageRequestProcessorBase:
ml::PageRequestProcessor ml::PageRequestQueueInterface ml::MultiThreadedPageRequestProcessor ml::SingleThreadedPageRequestProcessor

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...
 
ProcessingTimeLinegetProcessingTimeLine ()
 Returns access to the processing timeline. More...
 
ProcessingTimeLine::TimeLinegetOverviewTimeLine ()
 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...
 
- Public Member Functions inherited from ml::PageRequestProcessor
 ~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...
 
- Public Member Functions inherited from ml::PageRequestQueueInterface
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...
 
UserThreadDatagetUserThreadData (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 Public Member Functions inherited from ml::PageRequestProcessor
static void enableTileRequestAllocationFailure (int count=1)
 Enables failing on every count allocation. More...
 
static void disableTileRequestAllocationFailure ()
 Disables allocation failure. This is the default! More...
 

Detailed Description

Base class for single and multithreaded processor.

Definition at line 35 of file mlPageRequestProcessorBase.h.

Constructor & Destructor Documentation

◆ PageRequestProcessorBase()

ml::PageRequestProcessorBase::PageRequestProcessorBase ( Host host)

◆ ~PageRequestProcessorBase()

ml::PageRequestProcessorBase::~PageRequestProcessorBase ( )
override

Member Function Documentation

◆ addNewCursor()

void ml::PageRequestProcessorBase::addNewCursor ( PageRequestCursor cursor)
protected

Adds the new cursor.

◆ createMoreWork()

bool ml::PageRequestProcessorBase::createMoreWork ( bool  sleepWhenBlocked,
bool *  allBlocked = nullptr,
MLint  pageRequestLimit = 100000,
MLint resultPageRequestCount = nullptr 
)
protected

Creates more work items, returns true if new work was created.

◆ enableTimeLineProfiling()

void ml::PageRequestProcessorBase::enableTimeLineProfiling ( bool  flag)

Enables/disables timeline profiling.

◆ enterProcessingScope()

void ml::PageRequestProcessorBase::enterProcessingScope ( )
overridevirtual

Enters a recursive processing scope. This is always called from main thread!

Implements ml::PageRequestProcessor.

◆ getAllPageRequestQueues()

virtual void ml::PageRequestProcessorBase::getAllPageRequestQueues ( std::vector< std::deque< PageRequest * > * > &  queues)
protectedvirtual

Returns all page request queues (to be derived when there are more than the GUI queues).

◆ getOverviewTimeLine()

ProcessingTimeLine::TimeLine* ml::PageRequestProcessorBase::getOverviewTimeLine ( )
inline

Returns access to the overview timeline (only if timeline profiling is on).

Definition at line 53 of file mlPageRequestProcessorBase.h.

◆ getProcessingScope()

int ml::PageRequestProcessorBase::getProcessingScope ( ) const
inline

Returns the current processing scope.

Definition at line 62 of file mlPageRequestProcessorBase.h.

◆ getProcessingTimeLine()

ProcessingTimeLine& ml::PageRequestProcessorBase::getProcessingTimeLine ( )
inline

Returns access to the processing timeline.

Definition at line 50 of file mlPageRequestProcessorBase.h.

◆ getUserThreadData()

UserThreadData* ml::PageRequestProcessorBase::getUserThreadData ( PageRequest request,
PerThreadStorage perThreadStorage 
)
protected

Returns or allocates the UserThreadData for the given request as part of the perThreadStorage.

◆ handleErrorsInGUIThread()

virtual void ml::PageRequestProcessorBase::handleErrorsInGUIThread ( )
protectedvirtual

Handles all errors that have been accumulated.

◆ isTimeLineProfilingEnabled()

bool ml::PageRequestProcessorBase::isTimeLineProfilingEnabled ( ) const
inline

Returns whether timeline profiling is enabled.

Definition at line 59 of file mlPageRequestProcessorBase.h.

◆ leaveProcessingScope()

void ml::PageRequestProcessorBase::leaveProcessingScope ( )
overridevirtual

Leaves a recursive processing scope. This is always called from main thread!

Implements ml::PageRequestProcessor.

◆ removeCancelledRequests()

void ml::PageRequestProcessorBase::removeCancelledRequests ( )
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.

◆ setupCurrentProcessingScope()

void ml::PageRequestProcessorBase::setupCurrentProcessingScope ( )
protected

Helper.

◆ supportsMultiThreading()

virtual bool ml::PageRequestProcessorBase::supportsMultiThreading ( )
pure virtual

Returns whether multithreading is supported.

Implemented in ml::SingleThreadedPageRequestProcessor, and ml::MultiThreadedPageRequestProcessor.

◆ terminateAllRequestsInGUIThread()

void ml::PageRequestProcessorBase::terminateAllRequestsInGUIThread ( )
protected

Terminates all requests.

Member Data Documentation

◆ _currentScope

ScopeStackEntry* ml::PageRequestProcessorBase::_currentScope
protected

The current scope pointer.

Definition at line 141 of file mlPageRequestProcessorBase.h.

◆ _cursors

std::vector< std::vector<PageRequestCursor*> > ml::PageRequestProcessorBase::_cursors
protected

The cursors that are handled by the producer thread, one list for each processing scope.

Definition at line 100 of file mlPageRequestProcessorBase.h.

◆ _guiPerThreadStorage

PerThreadStorage ml::PageRequestProcessorBase::_guiPerThreadStorage
protected

The per-thread storage for the GUI thread.

Definition at line 165 of file mlPageRequestProcessorBase.h.

◆ _guiThreadRecursionCounter

int ml::PageRequestProcessorBase::_guiThreadRecursionCounter
protected

The recursion of the GUI thread (0 = outer entry).

Definition at line 117 of file mlPageRequestProcessorBase.h.

◆ _guiThreadTimeLine

ProcessingTimeLine::TimeLine* ml::PageRequestProcessorBase::_guiThreadTimeLine
protected

Definition at line 106 of file mlPageRequestProcessorBase.h.

◆ _host

Host* ml::PageRequestProcessorBase::_host
protected

Optional pointer to the host.

Definition at line 90 of file mlPageRequestProcessorBase.h.

◆ _overviewTimeLine

ProcessingTimeLine::TimeLine* ml::PageRequestProcessorBase::_overviewTimeLine
protected

Definition at line 107 of file mlPageRequestProcessorBase.h.

◆ _processingScope

int ml::PageRequestProcessorBase::_processingScope
protected

The current processing scope (0 = BG tasks, 1 = normal get tile, >1 = recursive get tile).

Definition at line 111 of file mlPageRequestProcessorBase.h.

◆ _producerCursorCounter

int ml::PageRequestProcessorBase::_producerCursorCounter
protected

How many cursors the producer contains in all lists.

Definition at line 115 of file mlPageRequestProcessorBase.h.

◆ _producerProcessingScope

int ml::PageRequestProcessorBase::_producerProcessingScope
protected

The current cursor scope of the producer.

Definition at line 113 of file mlPageRequestProcessorBase.h.

◆ _profile

ProcessingTimeLine ml::PageRequestProcessorBase::_profile
protected

Definition at line 105 of file mlPageRequestProcessorBase.h.

◆ _progressUpdateTimer

TimeCounter ml::PageRequestProcessorBase::_progressUpdateTimer
protected

Timer used for progress update from GUI thread.

Definition at line 148 of file mlPageRequestProcessorBase.h.

◆ _rootTileRequests

int ml::PageRequestProcessorBase::_rootTileRequests
protected

The number of root tile requests; if this gets down to 0, we are done.

Definition at line 96 of file mlPageRequestProcessorBase.h.

◆ _scopeStack

std::vector<ScopeStackEntry> ml::PageRequestProcessorBase::_scopeStack
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.

◆ _terminated

bool ml::PageRequestProcessorBase::_terminated
protected

Flag whether the calculation was terminated.

Definition at line 93 of file mlPageRequestProcessorBase.h.

◆ _useTimeLineProfiling

bool ml::PageRequestProcessorBase::_useTimeLineProfiling
protected

Definition at line 104 of file mlPageRequestProcessorBase.h.


The documentation for this class was generated from the following file: