Add Windows 11 VM configuration and setup for GPU passthrough
- Created a new XML configuration file for Windows 11 VM with enhanced resource allocation and device settings. - Added an old configuration file for reference. - Implemented an Ansible playbook to set up a GPU passthrough host on Fedora, including necessary package installations, GRUB configuration, and udev rules for persistent device access. - Introduced a Python script to monitor CPU power usage via Intel RAPL interface.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import time
|
||||
import os
|
||||
|
||||
RAPL_PATH = "/sys/class/powercap/intel-rapl:0/energy_uj"
|
||||
|
||||
def read_energy():
|
||||
try:
|
||||
with open(RAPL_PATH, "r") as f:
|
||||
return int(f.read().strip())
|
||||
except FileNotFoundError:
|
||||
print(f"Error: {RAPL_PATH} not found.")
|
||||
exit(1)
|
||||
|
||||
def calculate_power(interval=1.0):
|
||||
print(f"Monitoring CPU package power every {interval} second(s)... (Ctrl+C to stop)")
|
||||
while True:
|
||||
energy_before = read_energy()
|
||||
time.sleep(interval)
|
||||
energy_after = read_energy()
|
||||
|
||||
delta_uj = energy_after - energy_before
|
||||
power_watts = (delta_uj / 1_000_000) / interval
|
||||
|
||||
print(f"Power Usage: {power_watts:.2f} Watts")
|
||||
|
||||
if __name__ == "__main__":
|
||||
if os.geteuid() != 0:
|
||||
print("Please run this script as root.")
|
||||
exit(1)
|
||||
try:
|
||||
calculate_power(interval=1.0)
|
||||
except KeyboardInterrupt:
|
||||
print("\nStopped.")
|
||||
Reference in New Issue
Block a user