MeVisLab Toolbox Reference
ml::PageRequestProcessorBase Class Referenceabstract

Base class for single and multi-threaded processor. More...

#include <mlPageRequestProcessorBase.h>

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

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. More...
 
void removeCancelledRequests () override
 Removes all requests that are canceled and no longer needed. More...
 
ProcessingTimeLinegetProcessingTimeLine ()
 Get access to the processing time line. More...
 
ProcessingTimeLine::TimeLinegetOverviewTimeLine ()
 Get access to the overview time line (only if time line profiling is on) More...
 
void enableTimeLineProfiling (bool flag)
 Enable/disable time line profiling. More...
 
bool isTimeLineProfilingEnabled () const
 Returns if time line profiling is enabled. More...
 
int getProcessingScope () const
 Return the current processing scope. More...
 
void enterProcessingScope () override
 Enters a recursive processing scope (always called from main thread!) More...
 
void leaveProcessingScope () override
 Leaves a recursive processing scope (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
 Process the requests for the given timeBudget given in seconds. More...
 
virtual bool needsProcessing ()=0
 Returns if the tile request needs some more processing. More...
 
virtual void setNumWorkerThreads (std::size_t)=0
 Set number of worker threads (available here even if subclasses may not support it) More...
 
virtual bool processingWasSingleThreaded () const =0
 Returns if the last request was processed single or multi-threaded. More...
 
- Public Member Functions inherited from ml::PageRequestQueueInterface
virtual ~PageRequestQueueInterface ()
 Virtual destructor to get rid of warning. More...
 
virtual void append (PageRequest *request)=0
 Append PageRequest request which 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 ()
 handle all errors that have been accumulated More...
 
void terminateAllRequestsInGUIThread ()
 terminate all requests More...
 
void addNewCursor (PageRequestCursor *cursor)
 add the new cursor More...
 
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) More...
 
UserThreadDatagetUserThreadData (PageRequest *request, PerThreadStorage &perThreadStorage)
 Gets 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 if 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 for performance reasons, we only grow this stack, we never shrink it. 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 (default!) More...
 

Detailed Description

Base class for single and multi-threaded 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

add 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)

Enable/disable time line profiling.

◆ enterProcessingScope()

void ml::PageRequestProcessorBase::enterProcessingScope ( )
overridevirtual

Enters a recursive processing scope (always called from main thread!)

Implements ml::PageRequestProcessor.

◆ getAllPageRequestQueues()

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

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

◆ getOverviewTimeLine()

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

Get access to the overview time line (only if time line profiling is on)

Definition at line 53 of file mlPageRequestProcessorBase.h.

◆ getProcessingScope()

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

Return the current processing scope.

Definition at line 62 of file mlPageRequestProcessorBase.h.

◆ getProcessingTimeLine()

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

Get access to the processing time line.

Definition at line 50 of file mlPageRequestProcessorBase.h.

◆ getUserThreadData()

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

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

◆ handleErrorsInGUIThread()

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

handle all errors that have been accumulated

◆ isTimeLineProfilingEnabled()

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

Returns if time line profiling is enabled.

Definition at line 59 of file mlPageRequestProcessorBase.h.

◆ leaveProcessingScope()

void ml::PageRequestProcessorBase::leaveProcessingScope ( )
overridevirtual

Leaves a recursive processing scope (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 in 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 if multi-threading is supported.

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

◆ terminateAllRequestsInGUIThread()

void ml::PageRequestProcessorBase::terminateAllRequestsInGUIThread ( )
protected

terminate 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 if 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: