Hedgehog  3.1.0
A library to generate hybrid pipeline workflow systems
Loading...
Searching...
No Matches
hh::core::abstraction::TaskNodeAbstraction Class Referenceabstract

Task core abstraction used to define some method for task-like behaving cores like CoreExecutionPipeline, CoreStateManager, CoreTask. More...

#include "task_node_abstraction.h"

Inheritance diagram for hh::core::abstraction::TaskNodeAbstraction:
Inheritance graph
Collaboration diagram for hh::core::abstraction::TaskNodeAbstraction:
Collaboration graph

Public Member Functions

 TaskNodeAbstraction (std::string const &name, behavior::Node *node)
 Create the abstraction with the node's name.
 
 ~TaskNodeAbstraction () override=default
 Default destructor.
 
bool isActive () const
 Accessor to task status.
 
bool isInitialized () const
 Accessor to initialized flag.
 
size_t numberReceivedElements () const
 Accessor to the number of received elements.
 
std::chrono::nanoseconds const & waitDuration () const
 Accessor to the duration the node was in a wait state.
 
std::chrono::nanoseconds const & memoryWaitDuration () const
 Accessor to the duration the node was in a memory wait state.
 
std::shared_ptr< NvtxProfiler > const & nvtxProfiler () const
 Accessor to the NVTX profiler attached to the node.
 
std::chrono::nanoseconds perElementExecutionDuration () const
 Accessor to the duration the average duration of processing an input data.
 
void isActive (bool isActive)
 Setter to the task status.
 
void incrementNumberReceivedElements ()
 Increment the number of elements received.
 
void incrementWaitDuration (std::chrono::nanoseconds const &wait)
 Increment the wait duration.
 
void incrementMemoryWaitDuration (std::chrono::nanoseconds const &wait)
 Increase the memory wait duration.
 
void incrementPerElementExecutionDuration (std::chrono::nanoseconds const &exec)
 Increase the execution time per elements.
 
virtual void preRun ()=0
 Pre run method, called only once.
 
virtual void run ()=0
 Run method, called when thread is attached.
 
virtual void postRun ()=0
 Post run method, called only once.
 
virtual std::string extraPrintingInformation () const =0
 Abstraction to add user-defined message for the printers.
 
virtual bool hasMemoryManagerAttached () const =0
 Flag accessor to the presence of memory manager attached.
 
virtual std::shared_ptr< AbstractMemoryManagermemoryManager () const =0
 Accessor to the attached memory manager.
 
behavior::Nodenode () const override
 Node accessor.
 
- Public Member Functions inherited from hh::core::abstraction::NodeAbstraction
 NodeAbstraction (std::string name)
 Core node constructor using the core's name.
 
virtual ~NodeAbstraction ()=default
 DEfault destructor.
 
std::string const & name () const
 Accessor to the core's name.
 
virtual std::string id () const
 Core's id ('x' + address of abstraction) as string.
 
bool isRegistered () const
 Accessor to registration flag.
 
GraphNodeAbstractionbelongingGraph () const
 Belonging graph accessor.
 
virtual int deviceId () const
 Get the device identifier (got from belonging graph)
 
virtual size_t graphId () const
 Get the graph identifier (got from belonging graph)
 
std::chrono::nanoseconds const & executionDuration () const
 Execution duration.
 
std::chrono::time_point< std::chrono::system_clock > const & startExecutionTimeStamp () const
 Accessor to the starting execution timestamp.
 
void startExecutionTimeStamp (std::chrono::time_point< std::chrono::system_clock > const &startExecutionTimeStamp)
 Setter to the starting execution timestamp.
 
void incrementExecutionDuration (std::chrono::nanoseconds const &exec)
 Increment execution duration.
 
virtual void registerNode (GraphNodeAbstraction *belongingGraph)
 Register node to the given graph.
 
virtual std::vector< std::pair< std::string const, std::string const > > ids () const =0
 Node ids [nodeId, nodeGroupId] accessor.
 
virtual behavior::Nodenode () const =0
 Node accessor.
 
- Public Member Functions inherited from hh::core::abstraction::PrintableAbstraction
tool::PrintOptions const & printOptions () const
 Print options const accessor.
 
tool::PrintOptionsprintOptions ()
 Print options accessor.
 
virtual void visit (Printer *printer)=0
 Visitor method, used by the printer to visit all nodes in the graph.
 

Protected Member Functions

void setInitialized ()
 Set the task as initialized.
 

Private Attributes

size_t numberReceivedElements_ = 0
 Number of elements received.
 
bool isActive_ = false
 Active flag.
 
bool isInitialized_ = false
 Is initialized flag.
 
std::chrono::nanoseconds perElementExecutionDuration_ = std::chrono::nanoseconds::zero()
 Node per element duration.
 
std::chrono::nanoseconds waitDuration_ = std::chrono::nanoseconds::zero()
 Node wait duration.
 
std::chrono::nanoseconds memoryWaitDuration_ = std::chrono::nanoseconds::zero()
 Node memory wait duration.
 
std::shared_ptr< NvtxProfilernvtxProfiler_ = nullptr
 Store hedgehog nvtx profiler for the task.
 
behavior::Nodenode_ = nullptr
 Node attache to this task-like core.
 

Detailed Description

Task core abstraction used to define some method for task-like behaving cores like CoreExecutionPipeline, CoreStateManager, CoreTask.

Definition at line 39 of file task_node_abstraction.h.

Constructor & Destructor Documentation

◆ TaskNodeAbstraction()

hh::core::abstraction::TaskNodeAbstraction::TaskNodeAbstraction ( std::string const &  name,
behavior::Node node 
)
inlineexplicit

Create the abstraction with the node's name.

Parameters
nameName of the node
nodeNode attached to this core

Definition at line 61 of file task_node_abstraction.h.

Here is the call graph for this function:

◆ ~TaskNodeAbstraction()

hh::core::abstraction::TaskNodeAbstraction::~TaskNodeAbstraction ( )
overridedefault

Default destructor.

Member Function Documentation

◆ extraPrintingInformation()

virtual std::string hh::core::abstraction::TaskNodeAbstraction::extraPrintingInformation ( ) const
pure virtual

◆ hasMemoryManagerAttached()

virtual bool hh::core::abstraction::TaskNodeAbstraction::hasMemoryManagerAttached ( ) const
pure virtual

◆ incrementMemoryWaitDuration()

void hh::core::abstraction::TaskNodeAbstraction::incrementMemoryWaitDuration ( std::chrono::nanoseconds const &  wait)
inline

Increase the memory wait duration.

Parameters
waitDuration in nanoseconds

Definition at line 116 of file task_node_abstraction.h.

◆ incrementNumberReceivedElements()

void hh::core::abstraction::TaskNodeAbstraction::incrementNumberReceivedElements ( )
inline

Increment the number of elements received.

Definition at line 108 of file task_node_abstraction.h.

Here is the caller graph for this function:

◆ incrementPerElementExecutionDuration()

void hh::core::abstraction::TaskNodeAbstraction::incrementPerElementExecutionDuration ( std::chrono::nanoseconds const &  exec)
inline

Increase the execution time per elements.

Parameters
execDuration in nanoseconds

Definition at line 120 of file task_node_abstraction.h.

Here is the caller graph for this function:

◆ incrementWaitDuration()

void hh::core::abstraction::TaskNodeAbstraction::incrementWaitDuration ( std::chrono::nanoseconds const &  wait)
inline

Increment the wait duration.

Parameters
waitDuration in nanoseconds

Definition at line 112 of file task_node_abstraction.h.

Here is the caller graph for this function:

◆ isActive() [1/2]

bool hh::core::abstraction::TaskNodeAbstraction::isActive ( ) const
inline

Accessor to task status.

Returns
True if the thread is up and running, else false

Definition at line 70 of file task_node_abstraction.h.

Here is the caller graph for this function:

◆ isActive() [2/2]

void hh::core::abstraction::TaskNodeAbstraction::isActive ( bool  isActive)
inline

Setter to the task status.

Parameters
isActiveStatus to set

Definition at line 105 of file task_node_abstraction.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isInitialized()

bool hh::core::abstraction::TaskNodeAbstraction::isInitialized ( ) const
inline

Accessor to initialized flag.

Returns
True if the task is initialized, else false

Definition at line 74 of file task_node_abstraction.h.

◆ memoryManager()

virtual std::shared_ptr< AbstractMemoryManager > hh::core::abstraction::TaskNodeAbstraction::memoryManager ( ) const
pure virtual

◆ memoryWaitDuration()

std::chrono::nanoseconds const & hh::core::abstraction::TaskNodeAbstraction::memoryWaitDuration ( ) const
inline

Accessor to the duration the node was in a memory wait state.

Returns
Memory wait state duration in nanoseconds

Definition at line 88 of file task_node_abstraction.h.

Here is the caller graph for this function:

◆ node()

behavior::Node * hh::core::abstraction::TaskNodeAbstraction::node ( ) const
inlineoverridevirtual

Node accessor.

Returns
Node attached to this core

Implements hh::core::abstraction::NodeAbstraction.

Definition at line 147 of file task_node_abstraction.h.

◆ numberReceivedElements()

size_t hh::core::abstraction::TaskNodeAbstraction::numberReceivedElements ( ) const
inline

Accessor to the number of received elements.

Returns
Number of received elements

Definition at line 80 of file task_node_abstraction.h.

Here is the caller graph for this function:

◆ nvtxProfiler()

std::shared_ptr< NvtxProfiler > const & hh::core::abstraction::TaskNodeAbstraction::nvtxProfiler ( ) const
inline

Accessor to the NVTX profiler attached to the node.

Returns
Wait state duration in nanoseconds

Definition at line 92 of file task_node_abstraction.h.

Here is the caller graph for this function:

◆ perElementExecutionDuration()

std::chrono::nanoseconds hh::core::abstraction::TaskNodeAbstraction::perElementExecutionDuration ( ) const
inline

Accessor to the duration the average duration of processing an input data.

Returns
Average duration of processing an input data in nanoseconds

Definition at line 96 of file task_node_abstraction.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ postRun()

◆ preRun()

◆ run()

virtual void hh::core::abstraction::TaskNodeAbstraction::run ( )
pure virtual

◆ setInitialized()

void hh::core::abstraction::TaskNodeAbstraction::setInitialized ( )
inlineprotected

Set the task as initialized.

Definition at line 151 of file task_node_abstraction.h.

Here is the caller graph for this function:

◆ waitDuration()

std::chrono::nanoseconds const & hh::core::abstraction::TaskNodeAbstraction::waitDuration ( ) const
inline

Accessor to the duration the node was in a wait state.

Returns
Wait state duration in nanoseconds

Definition at line 84 of file task_node_abstraction.h.

Here is the caller graph for this function:

Member Data Documentation

◆ isActive_

bool hh::core::abstraction::TaskNodeAbstraction::isActive_ = false
private

Active flag.

Definition at line 43 of file task_node_abstraction.h.

◆ isInitialized_

bool hh::core::abstraction::TaskNodeAbstraction::isInitialized_ = false
private

Is initialized flag.

Definition at line 44 of file task_node_abstraction.h.

◆ memoryWaitDuration_

std::chrono::nanoseconds hh::core::abstraction::TaskNodeAbstraction::memoryWaitDuration_ = std::chrono::nanoseconds::zero()
private

Node memory wait duration.

Definition at line 49 of file task_node_abstraction.h.

◆ node_

behavior::Node* hh::core::abstraction::TaskNodeAbstraction::node_ = nullptr
private

Node attache to this task-like core.

Definition at line 55 of file task_node_abstraction.h.

◆ numberReceivedElements_

size_t hh::core::abstraction::TaskNodeAbstraction::numberReceivedElements_ = 0
private

Number of elements received.

Definition at line 41 of file task_node_abstraction.h.

◆ nvtxProfiler_

std::shared_ptr<NvtxProfiler> hh::core::abstraction::TaskNodeAbstraction::nvtxProfiler_ = nullptr
private

Store hedgehog nvtx profiler for the task.

Definition at line 52 of file task_node_abstraction.h.

◆ perElementExecutionDuration_

std::chrono::nanoseconds hh::core::abstraction::TaskNodeAbstraction::perElementExecutionDuration_ = std::chrono::nanoseconds::zero()
private

Node per element duration.

Definition at line 47 of file task_node_abstraction.h.

◆ waitDuration_

std::chrono::nanoseconds hh::core::abstraction::TaskNodeAbstraction::waitDuration_ = std::chrono::nanoseconds::zero()
private

Node wait duration.

Definition at line 48 of file task_node_abstraction.h.