3 #include <Core/RaCore.hpp>
4 #include <Core/Utils/Index.hpp>
5 #include <Core/Utils/Timer.hpp>
7 #include <condition_variable>
39 Utils::TimePoint start;
60 TaskId registerTask( std::unique_ptr<Task> task );
65 void removeTask(
TaskId taskId );
67 TaskId getTaskId(
const std::string& taskName )
const;
71 void addDependency(
TaskId predecessor,
TaskId successor );
75 bool addDependency(
const std::string& predecessors,
TaskId successor );
76 bool addDependency(
TaskId predecessor,
const std::string& successors );
80 void addPendingDependency(
const std::string& predecessors,
TaskId successor );
81 void addPendingDependency(
TaskId predecessor,
const std::string& successors );
95 void runTasksInThisThread();
101 const std::vector<TimerData>& getTimerData();
104 void flushTaskQueue();
107 void printTaskGraph( std::ostream& output )
const;
111 void runThread( uint
id );
115 void queueTask(
TaskId task );
122 void resolveDependencies();
126 std::vector<std::thread> m_workerThreads;
128 std::vector<std::unique_ptr<Task>> m_tasks;
130 std::vector<std::vector<TaskId>> m_dependencies;
133 std::vector<std::pair<TaskId, std::string>> m_pendingDepsPre;
134 std::vector<std::pair<std::string, TaskId>> m_pendingDepsSucc;
137 std::vector<TimerData> m_timerData;
144 std::vector<uint> m_remainingDependencies;
146 std::deque<TaskId> m_taskQueue;
148 uint m_processingTasks;
153 std::condition_variable m_threadNotifier;
155 std::mutex m_taskQueueMutex;
158 std::mutex m_taskMutex;
Utils::Index TaskId
Identifier for a task in the task queue.
Record of a task's start and end time.