HTGS
v2.0
The Hybrid Task Graph Scheduler
|
Manages the input/output of IData between Tasks. More...
#include <htgs/core/graph/Connector.hpp>
Public Member Functions | |
Connector () | |
Initializes the Connector with no producer tasks. | |
~Connector () | |
Destructor. | |
bool | isInputTerminated () override |
Checks whether the producer for this Connector has finished pushing data onto its queue. More... | |
Connector< T > * | copy () override |
Creates a copy of the BaseConnector. More... | |
void | wakeupConsumer () override |
Awakens all Tasks that are consuming data from this connector. More... | |
void | profileProduce (size_t numThreads) override |
Provide profile output for the produce operation. More... | |
void | profileConsume (size_t numThreads, bool showQueueSize) override |
Provides profile output for the consume operation. More... | |
size_t | getQueueSize () override |
Gets the size of the queue that this connector has in its data queue. More... | |
size_t | getMaxQueueSize () override |
Gets the maximum queue size that this connector has in its data queue. More... | |
void | resetMaxQueueSize () override |
Resets the max queue size profile. | |
void | produceAnyData (std::shared_ptr< IData > data) override |
Produces any data into the queue. More... | |
std::shared_ptr< T > | pollConsumeData (size_t timeout) |
Polls for data for a consumer given a timeout. More... | |
std::shared_ptr< T > | consumeData () |
Consumes data from the queue. More... | |
void | produceData (std::shared_ptr< T > data) |
Produces data into the queue. More... | |
void | produceData (std::list< std::shared_ptr< T >> *data) |
Produces a list of data adding each element into the queue. More... | |
std::string | typeName () override |
Gets the demangled type name of the connector. More... | |
Public Member Functions inherited from htgs::AnyConnector | |
AnyConnector () | |
Constructor initializing the producer task count to 0. | |
virtual | ~AnyConnector () |
Virtual destructor. | |
void | producerFinished () |
Indicates to the Connector that the producer has finished producing data for the Connector. More... | |
size_t | getProducerCount () |
Gets the number of producers producing data for the connector. More... | |
void | incrementInputTaskCount () |
Increments the number of tasks producing data for the Connector. More... | |
std::string | getDotId () |
Gets the id used for dot graphs for GraphViz. More... | |
std::string | genDot (int flags) |
Generates the dot representation for this connector. More... | |
Private Attributes | |
BlockingQueue< std::shared_ptr< T > > | queue |
The blocking queue associated with the connector (thread safe) (can be switched to a priority queue using the USE_PRIORITY_QUEUE directive) | |
Manages the input/output of IData between Tasks.
Each IData that is produced for the Connector is inserted based on the priority specified by the IData (lowest order value first by default IData::getOrder()).
Priority queue is enabled by defining the USE_PRIORITY_QUEUE directive during compilation.
The Connector manages how many Tasks are producing and consuming data for a particular Connector. For a given ITask, if that ITask has more than one thread associated with it, then each thread acts as a separate producer for the Connector. The Connector will not indicate it has finished producing data until all producers have indicated that they have finished.
If a data stream is producing data outside of a TaskGraphConf, then that stream must indicate it is an InputTask otherwise the ITask associated with this Connector may terminate prior to processing data. By incrementing the input task count, will ensure the Connector stays open for an ITask until the stream producing data indicates it has finished. To increment the input Task count use incrementInputTaskCount() and to indicate the input has finished producing data use producerFinished().
|
inline |
Consumes data from the queue.
|
inlineoverridevirtual |
Creates a copy of the BaseConnector.
Implements htgs::AnyConnector.
|
inlineoverridevirtual |
Gets the maximum queue size that this connector has in its data queue.
Implements htgs::AnyConnector.
|
inlineoverridevirtual |
Gets the size of the queue that this connector has in its data queue.
Implements htgs::AnyConnector.
|
inlineoverridevirtual |
Checks whether the producer for this Connector has finished pushing data onto its queue.
TRUE | if the input has terminated and no more data is in the queue. |
FALSE | if there is still data to be processed. |
Implements htgs::AnyConnector.
|
inline |
Polls for data for a consumer given a timeout.
timeout | the timeout time in microseconds |
DATA | the next data that is on the queue |
nullptr | if the timeout time expires |
|
inlineoverridevirtual |
Produces any data into the queue.
This function should be used with care as the data will be dynamically cast to the type of Connector.
data | the data that will be added to the Connector's queue. |
Implements htgs::AnyConnector.
|
inline |
Produces data into the queue.
data | the data to be added |
|
inline |
Produces a list of data adding each element into the queue.
data | the list of data t obe added |
|
inlineoverridevirtual |
Provides profile output for the consume operation.
numThreads | the number of threads associated with consuming data |
showQueueSize | whether to show the max queue size or not |
Implements htgs::AnyConnector.
|
inlineoverridevirtual |
Provide profile output for the produce operation.
numThreads | the number of threads associated with producing data |
Implements htgs::AnyConnector.
|
inlineoverridevirtual |
Gets the demangled type name of the connector.
Implements htgs::AnyConnector.
|
inlineoverridevirtual |
Awakens all Tasks that are consuming data from this connector.
This function passes nullptr to each consumer to check whether that consumer is ready to be terminated.
Implements htgs::AnyConnector.