DPsim
ThreadLevelScheduler.h
1 /* Copyright 2017-2021 Institute for Automation of Complex Power Systems,
2  * EONERC, RWTH Aachen University
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
7  *********************************************************************************/
8 
9 #pragma once
10 
11 #include <dpsim/ThreadScheduler.h>
12 
13 namespace DPsim {
15 public:
16  ThreadLevelScheduler(Int threads = 1, String outMeasurementFile = String(),
17  String inMeasurementFile = String(),
18  Bool useConditionVariables = false,
19  Bool sortTaskTypes = false);
20 
21  void createSchedule(const CPS::Task::List &tasks, const Edges &inEdges,
22  const Edges &outEdges);
23 
24 private:
25  void
26  scheduleLevel(const CPS::Task::List &tasks,
27  const std::unordered_map<String, TaskTime::rep> &measurements,
28  const Edges &inEdges);
29  void sortTasksByType(CPS::Task::List::iterator begin,
30  CPS::Task::List::iterator end);
31 
32  String mInMeasurementFile;
33  Bool mSortTaskTypes;
34 };
35 }; // namespace DPsim
std::unordered_map< CPS::Task::Ptr, std::deque< CPS::Task::Ptr > > Edges
Definition: Scheduler.h:31
void createSchedule(const CPS::Task::List &tasks, const Edges &inEdges, const Edges &outEdges)
Creates the schedule for the given dependency graph.