Skip to content

Commit dd45baa

Browse files
authored
Simulator in python with working test (#11)
* Update .gitignore to exclude .vscode directory * correct ruff format * Refactor simulator code and add job handling functionality; update .gitignore to exclude .pyc files * ref * Remove obsolete test file, update .gitignore to exclude additional cache files, and add new exercise files and task handler script for response time analysis
1 parent 9f20416 commit dd45baa

26 files changed

Lines changed: 253 additions & 134 deletions

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
tests/.tmp
33
.pytest_cache
44
.vscode
5-
__pycache__
5+
__pycache__
6+
.vscode
7+
.ruff_cache

Exercises/Response-Time Analysis/.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "Debug C++",
66
"type": "cppdbg",
77
"request": "launch",
8-
"program": "${workspaceFolder}/build/response_time_analysis",
8+
"program": "${workspaceFolder}/build/response_time_analysis",
99
"args": ["${workspaceFolder}/exercise-TC2.csv"],
1010
"stopAtEntry": false,
1111
"cwd": "${workspaceFolder}",
@@ -22,4 +22,4 @@
2222
"preLaunchTask": "build"
2323
}
2424
]
25-
}
25+
}

Exercises/Response-Time Analysis/.vscode/tasks.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
"problemMatcher": ["$gcc"]
1919
}
2020
]
21-
}
21+
}

Exercises/Response-Time Analysis/src/response_time_analysis.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ struct Task {
1111
string id;
1212
int BCET;
1313
int WCET;
14-
int period;
15-
int deadline;
14+
int period;
15+
int deadline;
1616
int priority; // Lower number => higher priority for RMS, if you wish
1717
};
1818

@@ -68,7 +68,7 @@ void RTA_test(vector<Task>& tasks)
6868
while (R != last_R)
6969
{
7070
last_R = R;
71-
int I = 0;
71+
int I = 0;
7272
for (size_t j = 0; j < i; j++)
7373
{
7474
I += ceil((double)R / tasks[j].period) * tasks[j].WCET;

Exercises/Very Simple Simulator/.vscode/c_cpp_properties.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

Exercises/Very Simple Simulator/.vscode/launch.json

Lines changed: 0 additions & 25 deletions
This file was deleted.

Exercises/Very Simple Simulator/.vscode/settings.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

Exercises/Very Simple Simulator/.vscode/tasks.json

Lines changed: 0 additions & 43 deletions
This file was deleted.
File renamed without changes.

Exercises/Very Simple Simulator/README.txt renamed to Exercises/VerySimpleSimulator/README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ README.txt
33
The files in the Exerercise/Content tab are test cases are provided as a starting point for the 02225 DRTS exercise.
44

55
They are in CSV (Comma-Separated Values) format and contain the model parameters for periodic tasks:
6-
6+
77
- Task: Task name
88
- BCET: Best-case execution time
99
- WCET: Worst-case execution time

0 commit comments

Comments
 (0)