ngscopeclient 0.1-dev+51fbda87c
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
FilterGraphExecutor Class Reference

Execution manager / scheduler for the filter graph. More...

#include <FilterGraphExecutor.h>

Public Member Functions

 FilterGraphExecutor (size_t numThreads=8)
 
void RunBlocking (const std::set< FlowGraphNode * > &nodes)
 Evaluates the filter graph, blocking until execution has completed.
 
FlowGraphNodeGetNextRunnableNode ()
 Returns the next filter available to run, blocking if none are ready. More...
 
std::map< FlowGraphNode *, int64_t > GetRunTimes ()
 Get the run times of the most recent filter graph evaluation.
 

Protected Member Functions

void DoExecutorThread (size_t i)
 
void UpdateRunnable ()
 Searches m_incompleteNodes for any that are unblocked, and adds them to m_runnableNodes. More...
 

Static Protected Member Functions

static void ExecutorThread (FilterGraphExecutor *pThis, size_t i)
 Thread function to handle filter graph execution.
 

Protected Attributes

std::mutex m_mutex
 Mutex for access to shared state.
 
std::set< FlowGraphNode * > m_incompleteNodes
 Nodes that have not yet been updated.
 
std::set< FlowGraphNode * > m_runnableNodes
 Nodes that have no dependencies and are eligible to run now.
 
std::set< FlowGraphNode * > m_runningNodes
 Nodes that are actively being run.
 
std::vector< std::unique_ptr< std::thread > > m_threads
 Set of thread contexts.
 
std::condition_variable m_workerCvar
 Condition variable for waking up worker threads when work arrives.
 
std::mutex m_workerCvarMutex
 Mutex for access to m_workerCvar.
 
std::condition_variable m_completionCvar
 Condition variable for waking up main thread when work is complete.
 
std::mutex m_completionCvarMutex
 Mutex for access to m_completionCvar.
 
bool m_allWorkersComplete
 Indicates that all worker threads have finished executing this pass.
 
bool m_terminating
 Shutdown flag.
 
std::map< FlowGraphNode *, int64_t > m_lastExecutionTime
 Performance statistics from previous execution.
 
std::map< FlowGraphNode *, int64_t > m_currentExecutionTime
 Performance statistics from current execution.
 
std::mutex m_perfStatsMutex
 Mutex for updating performance statistics.
 

Detailed Description

Execution manager / scheduler for the filter graph.

Member Function Documentation

◆ GetNextRunnableNode()

FlowGraphNode * FilterGraphExecutor::GetNextRunnableNode ( )

Returns the next filter available to run, blocking if none are ready.

Returns null if there are no remaining filters to evaluate.

◆ UpdateRunnable()

void FilterGraphExecutor::UpdateRunnable ( )
protected

Searches m_incompleteNodes for any that are unblocked, and adds them to m_runnableNodes.

Assumes m_mutex is locked


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