Skip to content

Commit

Permalink
plot memory data point
Browse files Browse the repository at this point in the history
  • Loading branch information
abraham2512 committed Dec 18, 2024
1 parent a1e8c44 commit 87d4dd7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions backend/app/api/v1/endpoints/telco/telcoGraphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand All @@ -139,21 +140,23 @@ 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


if is_row:
return 1 if (minus_avg_cpu != 0 or minus_max_cpu != 0) else 0
else:
return {
"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,
Expand Down

0 comments on commit 87d4dd7

Please sign in to comment.