MeVisLab Toolbox Reference
ml::MultiThreadedPageRequestProcessor Class Reference

A multi-threaded processor that takes one or even multiple tile requests and can process them iteratively. More...

#include <mlMultiThreadedPageRequestProcessor.h>

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

Public Member Functions

 MultiThreadedPageRequestProcessor (Host *host=nullptr)
 
 ~MultiThreadedPageRequestProcessor () override
 
bool supportsMultiThreading () override
 Returns if multi-threading is supported. More...
 
void setNumWorkerThreads (std::size_t threads) override
 Set number of worker threads. More...
 
void addRootTileRequest (TileRequest *tileRequest) override
 Adds the root tileRequest that should be processed (the ownership stays with the caller). More...
 
void processAll () override
 Processes all requests until the cursors have traversed the whole tree and the queue is empty. More...
 
void process (double timeBudget) override
 Process the requests for the given timeBudget given in seconds. More...
 
void launchMultiThreading ()
 Launch the multi-threading. More...
 
bool needsProcessing () override
 Returns if the tile request needs some more processing. More...
 
void append (PageRequest *request) override
 Implements PageRequestQueueInterface interface. 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...
 
bool processingWasSingleThreaded () const override
 Processing is always single-threaded, only implemented for testing purposes. More...
 
void setAllowLateMultiThreadingStart (bool flag)
 This can be set to false to debug single threaded part of this class... More...
 
- Public Member Functions inherited from ml::PageRequestProcessorBase
 PageRequestProcessorBase (Host *host)
 
 ~PageRequestProcessorBase () override
 
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...
 
- Public Member Functions inherited from ml::PageRequestQueueInterface
virtual ~PageRequestQueueInterface ()
 Virtual destructor to get rid of warning. More...
 

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...
 
- Protected Member Functions inherited from ml::PageRequestProcessorBase
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...
 
void terminateAllRequestsInGUIThread ()
 terminate all requests More...
 
void addNewCursor (PageRequestCursor *cursor)
 add the new cursor More...
 
UserThreadDatagetUserThreadData (PageRequest *request, PerThreadStorage &perThreadStorage)
 Gets or allocates the UserThreadData for the given request as part of the perThreadStorage. More...
 
- Protected Attributes inherited from ml::PageRequestProcessorBase
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...
 
bool _useTimeLineProfiling
 
ProcessingTimeLine _profile
 
ProcessingTimeLine::TimeLine_guiThreadTimeLine
 
ProcessingTimeLine::TimeLine_overviewTimeLine
 

Detailed Description

A multi-threaded processor that takes one or even multiple tile requests and can process them iteratively.

Definition at line 45 of file mlMultiThreadedPageRequestProcessor.h.

Constructor & Destructor Documentation

◆ MultiThreadedPageRequestProcessor()

ml::MultiThreadedPageRequestProcessor::MultiThreadedPageRequestProcessor ( Host host = nullptr)

◆ ~MultiThreadedPageRequestProcessor()

ml::MultiThreadedPageRequestProcessor::~MultiThreadedPageRequestProcessor ( )
override

Member Function Documentation

◆ addRootTileRequest()

void ml::MultiThreadedPageRequestProcessor::addRootTileRequest ( TileRequest tileRequest)
overridevirtual

Adds the root tileRequest that should be processed (the ownership stays with the caller).

Implements ml::PageRequestProcessor.

◆ append()

void ml::MultiThreadedPageRequestProcessor::append ( PageRequest request)
overridevirtual

Implements PageRequestQueueInterface interface.

Implements ml::PageRequestQueueInterface.

◆ enterProcessingScope()

void ml::MultiThreadedPageRequestProcessor::enterProcessingScope ( )
overridevirtual

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

Implements ml::PageRequestProcessor.

◆ launchMultiThreading()

void ml::MultiThreadedPageRequestProcessor::launchMultiThreading ( )

Launch the multi-threading.

◆ leaveProcessingScope()

void ml::MultiThreadedPageRequestProcessor::leaveProcessingScope ( )
overridevirtual

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

Implements ml::PageRequestProcessor.

◆ needsProcessing()

bool ml::MultiThreadedPageRequestProcessor::needsProcessing ( )
overridevirtual

Returns if the tile request needs some more processing.

Implements ml::PageRequestProcessor.

◆ process()

void ml::MultiThreadedPageRequestProcessor::process ( double  timeBudget)
overridevirtual

Process the requests for the given timeBudget given in seconds.

Implements ml::PageRequestProcessor.

◆ processAll()

void ml::MultiThreadedPageRequestProcessor::processAll ( )
overridevirtual

Processes all requests until the cursors have traversed the whole tree and the queue is empty.

Implements ml::PageRequestProcessor.

◆ processingWasSingleThreaded()

bool ml::MultiThreadedPageRequestProcessor::processingWasSingleThreaded ( ) const
inlineoverridevirtual

Processing is always single-threaded, only implemented for testing purposes.

Implements ml::PageRequestProcessor.

Definition at line 81 of file mlMultiThreadedPageRequestProcessor.h.

◆ setAllowLateMultiThreadingStart()

void ml::MultiThreadedPageRequestProcessor::setAllowLateMultiThreadingStart ( bool  flag)
inline

This can be set to false to debug single threaded part of this class...

Definition at line 84 of file mlMultiThreadedPageRequestProcessor.h.

◆ setNumWorkerThreads()

void ml::MultiThreadedPageRequestProcessor::setNumWorkerThreads ( std::size_t  threads)
overridevirtual

Set number of worker threads.

Implements ml::PageRequestProcessor.

◆ supportsMultiThreading()

bool ml::MultiThreadedPageRequestProcessor::supportsMultiThreading ( )
inlineoverridevirtual

Returns if multi-threading is supported.

Implements ml::PageRequestProcessorBase.

Definition at line 52 of file mlMultiThreadedPageRequestProcessor.h.


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