diff --git a/xgb.py b/xgb.py index 4e789b0..8e2c5b5 100644 --- a/xgb.py +++ b/xgb.py @@ -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() @@ -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)