I have a web application running in gunicorn server with 4 workers and 4 threads, i am using psutil to fetch the cpu utilization as follows
process = psutil.Process(os.getpid())
while True:
print("cpu Utilization",process.cpu_percent(interval=0)/psutil.cpu_count())
the above code will print cpu percent of each workers pids with cpu_cores
if i want to get overall cpu utilization of the application, how can i get it,
and if the application or process is using only 2 or 3 cpu cores.(psutil.Process().cpu_affinity()) then should i need to caluclate cpu percent by dividing with num of used cores