Skip to content

Commit

Permalink
We need to divide by CPU count to not get > 100 vals and adds flushing
Browse files Browse the repository at this point in the history
  • Loading branch information
ribalba committed Feb 5, 2024
1 parent 33c6ace commit dfa8679
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions xgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def interpolate_predictions(predictions):
import psutil
def cpu_utalisation():
while True:
yield str(psutil.cpu_percent(args.interval) * 100)
yield str(psutil.cpu_percent(args.interval) * 100 / psutil.cpu_count())

input_source = cpu_utalisation()

Expand All @@ -156,9 +156,8 @@ def cpu_utalisation():
current_time = time.time_ns()
for line in input_source:
print(interpolated_predictions[float(line.strip())] * args.vhost_ratio * \
(time.time_ns() - current_time) / 1_000_000_000
)
(time.time_ns() - current_time) / 1_000_000_000, flush=True)
current_time = time.time_ns()
else:
for line in input_source:
print(interpolated_predictions[float(line.strip())] * args.vhost_ratio)
print(interpolated_predictions[float(line.strip())] * args.vhost_ratio, flush=True)

0 comments on commit dfa8679

Please sign in to comment.