chore: update documentation, benchmark tests, and database migration with author birth years and book published years
This commit is contained in:
+5
-4
@@ -4,11 +4,12 @@ import time
|
||||
try:
|
||||
with open('usage.log', 'a') as log_file:
|
||||
while True:
|
||||
cpu_percent = psutil.cpu_percent(interval=1)
|
||||
cpu = psutil.cpu_percent(interval=1)
|
||||
mem = psutil.virtual_memory()
|
||||
log_entry = f"CPU: {cpu_percent}%, Memory: {mem.percent}%\n"
|
||||
timestamp = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
log_entry = f"{timestamp} CPU: {cpu}% Memory: {mem.percent}%\n"
|
||||
log_file.write(log_entry)
|
||||
log_file.flush()
|
||||
time.sleep(4)
|
||||
time.sleep(4) # Already waited 1 sec in cpu_percent, so sleep 4 more to total 5
|
||||
except KeyboardInterrupt:
|
||||
print("Monitoring stopped by user.")
|
||||
print("Monitoring stopped by user.")"}
|
||||
Reference in New Issue
Block a user