From 8625fc8488418397779428fdc328ec6fc89121be Mon Sep 17 00:00:00 2001 From: Abraham Date: Wed, 18 Dec 2024 14:38:13 -0500 Subject: [PATCH 1/3] plot memory data point --- backend/app/api/v1/endpoints/telco/telcoGraphs.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/app/api/v1/endpoints/telco/telcoGraphs.py b/backend/app/api/v1/endpoints/telco/telcoGraphs.py index ab08d192..41c7cd42 100644 --- a/backend/app/api/v1/endpoints/telco/telcoGraphs.py +++ b/backend/app/api/v1/endpoints/telco/telcoGraphs.py @@ -131,6 +131,7 @@ def process_cpu_util(json_data: str, is_row: bool): total_avg_cpu = 0.0 minus_max_cpu = 0.0 minus_avg_cpu = 0.0 + total_avg_mem = 0.0 defined_threshold = 3.0 for each_scenario in json_data["scenarios"]: if each_scenario["scenario_name"] == "steadyworkload": @@ -145,6 +146,7 @@ def process_cpu_util(json_data: str, is_row: bool): if total_avg_cpu > defined_threshold: minus_avg_cpu = total_avg_cpu - defined_threshold + if is_row: return 1 if (minus_avg_cpu != 0 or minus_max_cpu != 0) else 0 else: @@ -152,8 +154,8 @@ def process_cpu_util(json_data: str, is_row: bool): "cpu_util": [ { "name": "Data Points", - "x": ["total_max_cpu", "total_avg_cpu"], - "y": [total_max_cpu, total_avg_cpu], + "x": ["total_max_cpu", "total_avg_cpu", "total_avg_mem"], + "y": [total_max_cpu, total_avg_cpu, total_avg_mem], "mode": "markers", "marker": { "size": 10, From 1f813f8c673c3a615ff22672c13102dbf833e563 Mon Sep 17 00:00:00 2001 From: Abraham Date: Wed, 18 Dec 2024 23:32:49 -0500 Subject: [PATCH 2/3] convert bytes to GB --- backend/app/api/v1/endpoints/telco/telcoGraphs.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/app/api/v1/endpoints/telco/telcoGraphs.py b/backend/app/api/v1/endpoints/telco/telcoGraphs.py index 41c7cd42..f0db5154 100644 --- a/backend/app/api/v1/endpoints/telco/telcoGraphs.py +++ b/backend/app/api/v1/endpoints/telco/telcoGraphs.py @@ -133,6 +133,7 @@ def process_cpu_util(json_data: str, is_row: bool): minus_avg_cpu = 0.0 total_avg_mem = 0.0 defined_threshold = 3.0 + bytes_per_gb = 1024 * 1024 * 1024 for each_scenario in json_data["scenarios"]: if each_scenario["scenario_name"] == "steadyworkload": for each_type in each_scenario["types"]: @@ -145,8 +146,8 @@ def process_cpu_util(json_data: str, is_row: bool): minus_max_cpu = total_max_cpu - defined_threshold if total_avg_cpu > defined_threshold: minus_avg_cpu = total_avg_cpu - defined_threshold - - + # Convert memory from bytes to GB + total_avg_mem /= bytes_per_gb if is_row: return 1 if (minus_avg_cpu != 0 or minus_max_cpu != 0) else 0 else: From dff5c0442398f54288d940ab63578cb5aa52080e Mon Sep 17 00:00:00 2001 From: Abraham Date: Wed, 15 Jan 2025 12:26:32 -0500 Subject: [PATCH 3/3] syntax for default 0 --- backend/app/api/v1/endpoints/telco/telcoGraphs.py | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/app/api/v1/endpoints/telco/telcoGraphs.py b/backend/app/api/v1/endpoints/telco/telcoGraphs.py index f0db5154..a062f435 100644 --- a/backend/app/api/v1/endpoints/telco/telcoGraphs.py +++ b/backend/app/api/v1/endpoints/telco/telcoGraphs.py @@ -141,6 +141,7 @@ def process_cpu_util(json_data: str, is_row: bool): total_max_cpu = each_type.get("max_cpu") or 0 break total_avg_cpu = each_scenario.get("avg_cpu_total") or 0 + total_avg_mem = each_scenario.get("avg_mem_total") or 0 break if total_max_cpu > defined_threshold: minus_max_cpu = total_max_cpu - defined_threshold