diff --git a/src/utils/scheduler.h b/src/utils/scheduler.h index a4a741806a7b387a13d16343b3335cc478e2a908..b45ad23a5c76f7c2eb908d39764cd817a03a5fee 100644 --- a/src/utils/scheduler.h +++ b/src/utils/scheduler.h @@ -1,10 +1,7 @@ - #ifndef SCHEDULER_H #define SCHEDULER_H - - #define CPU_CAP 20; #define MAX_TIMESTAMP 20; diff --git a/src/utils/utils.c b/src/utils/utils.c index eda57e66997293c1db3ec487670c561dbd117576..8ccd6e3f8aaaa4c326b1f2bc6ff2c023b8b91374 100644 --- a/src/utils/utils.c +++ b/src/utils/utils.c @@ -62,3 +62,20 @@ workload_item* _get_items(const char* filepath) fclose(file); return items; } + +int _get_priority_sum(workload_item* tasks, const size_t count) +{ + if (!tasks) + { + return -1; + } + + int sum = 0; + + for (size_t idx = 0; idx < count; ++idx) + { + sum += tasks[idx].prio; + } + + return sum; +} diff --git a/src/utils/utils.h b/src/utils/utils.h index 72aa5592ed3c12ad639b84c1bf82e1c5824c7892..e9b8e014dbd60f1d415ab1b65e53409d366d4047 100644 --- a/src/utils/utils.h +++ b/src/utils/utils.h @@ -8,4 +8,6 @@ workload_item* _get_items(const char* filepath); workload_item __parse_line(const char* line); +int _get_priority_sum(workload_item* tasks); + #endif //UTILS_H