From 8dab7d5d4b89dfffadfbdced58bd9372bdceb127 Mon Sep 17 00:00:00 2001
From: recabet <rajab.iskenderli@gmail.com>
Date: Tue, 25 Mar 2025 19:20:36 +0400
Subject: [PATCH] Added queue

---
 src/utils/scheduler.h |  3 ---
 src/utils/utils.c     | 17 +++++++++++++++++
 src/utils/utils.h     |  2 ++
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/utils/scheduler.h b/src/utils/scheduler.h
index a4a7418..b45ad23 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 eda57e6..8ccd6e3 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 72aa559..e9b8e01 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
-- 
GitLab