diff --git a/backend/app/api/v1/endpoints/telco/telcoGraphs.py b/backend/app/api/v1/endpoints/telco/telcoGraphs.py index 41b90cc1..6991745b 100644 --- a/backend/app/api/v1/endpoints/telco/telcoGraphs.py +++ b/backend/app/api/v1/endpoints/telco/telcoGraphs.py @@ -131,7 +131,9 @@ 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 + 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"]: @@ -139,12 +141,14 @@ def process_cpu_util(json_data: str, is_row: bool): total_max_cpu = each_type.get("max_cpu", 0) break total_avg_cpu = each_scenario.get("avg_cpu_total", 0) + total_avg_mem = each_scenario.get("avg_mem_total", 0) break if total_max_cpu > defined_threshold: 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: @@ -152,8 +156,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,