Skip to content

Commit

Permalink
convert bytes to GB
Browse files Browse the repository at this point in the history
  • Loading branch information
abraham2512 committed Dec 19, 2024
1 parent 87d4dd7 commit 041ef6d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backend/app/api/v1/endpoints/telco/telcoGraphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]:
Expand All @@ -146,8 +147,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:
Expand Down

0 comments on commit 041ef6d

Please sign in to comment.