Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plot memory data point #148

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions backend/app/api/v1/endpoints/telco/telcoGraphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,29 +131,33 @@ 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"]:
if each_type["type_name"] == "total":
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:
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