Skip to content

Commit

Permalink
Update mineral.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kishorsumathi authored Sep 6, 2023
1 parent 3333618 commit bb12d32
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/margsoft/mineral.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@ def collectdataset(rtsp,names_file,weight_file,cfg_file,path,dir_n,x_1,y_1,w_1,z
try:
while cap.isOpened():
cpu_percent = psutil.cpu_percent(interval=1)
if cpu_percent > exit_percent:
while cpu_percent > exit_percent:
print(f"CPU utilization: {cpu_percent}%")
print(f"CPU utilization exceeded {exit_percent}%. Exiting...")
sys.exit()
print(f"CPU utilization exceeded {exit_percent}%. Pausing until CPU utilization decreases...")
print("sleeping for 5 seconds)
time.sleep(5) # Sleep for 1 second before checking again
cpu_percent = psutil.cpu_percent(interval=1)

print(f"CPU utilization: {cpu_percent}%")
print(f"CPU utilization: {cpu_percent}%")
ret, frame = cap.read()
if poly:
Expand Down

0 comments on commit bb12d32

Please sign in to comment.