diff --git a/CMakeLists.txt b/CMakeLists.txt index 0037641..670cd01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,7 @@ add_executable( ) target_compile_features(runner PUBLIC cxx_std_17) -target_link_libraries(runner task) +target_link_libraries(runner analysis task mathFramework timedPath) include(FetchContent) FetchContent_Declare( diff --git a/source/Analysis.cpp b/source/Analysis.cpp index 49d6774..298ce21 100644 --- a/source/Analysis.cpp +++ b/source/Analysis.cpp @@ -8,7 +8,7 @@ std::set analysis::removeUnreachablePaths( for(const auto& path : pathSet) { if(mathframework::pathReach(path.asVector())) { - output.emplace(path); + output.insert(path); } } diff --git a/source/main.cpp b/source/main.cpp index 8f814cc..a296699 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -1,12 +1,63 @@ -#include +#include #include +#include +#include + +int readInt(const std::string& message); +TaskInstance readTaskInstance(); int main(void) { Task task(10, 5, 1); + std::string taskChainName; + int numOfTasks; + + std::cout << "Enter task chain name: "; + std::cin >> taskChainName; + + TimedPath timedPath; - std::cout << "Created a task with period " << task.period << " and wcet " - << task.wcet << std::endl; + numOfTasks = readInt("How many tasks should be in the chain: "); + + for (int i = 0; i < numOfTasks; i++) { + std::cout << "Reading Task " << i + 1 << std::endl; + TaskInstance taskInstance = readTaskInstance(); + timedPath.appendTaskInstance(taskInstance); + std::cout << std::endl; + } + + std::cout << "End to end timing: " << timedPath.endToEndDelay() << std::endl; return 0; -} \ No newline at end of file +} + +int readInt(const std::string& message) { + int output; + bool validInput = false; + + do { + std::cout << message; + std::cin >> output; + + if (std::cin.fail()) { + std::cout << std::endl + << "The input was not an integer, please try again" + << std::endl; + std::cin.clear(); + std::cin.ignore(std::numeric_limits::max(), '\n'); + } else { + validInput = true; + } + } while (!validInput); + + return output; +} + +TaskInstance readTaskInstance() { + int period = readInt("Enter task period: "); + int wcet = readInt("Enter worst case execution time for the task: "); + int priority = readInt("Enter task priority: "); + int activationTime = readInt("Enter task activation time or offset: "); + + return TaskInstance(Task(period, wcet, priority), activationTime); +}