Skip to content

Commit

Permalink
Current time must be set before blocking operation (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneTR authored Sep 8, 2024
1 parent b020b6c commit d9b92a0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions xgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,13 @@ def cpu_utilization():
print(f'cloud_energy_hashmap[{key:.2f}]={val*args.vhost_ratio}', flush=True)
sys.exit(0)


current_time = time.time_ns()
for line in input_source:
utilization = float(line.strip())
if utilization < 0 or utilization > 100:
raise ValueError("Utilization can not be over 100%. If you have multiple CPU cores please divide by cpu count.")

if args.energy:
current_time = time.time_ns()
print(interpolated_predictions[utilization] * args.vhost_ratio * \
(time.time_ns() - current_time) / 1_000_000_000, flush=True)
current_time = time.time_ns()
Expand Down

0 comments on commit d9b92a0

Please sign in to comment.