Solve Problems by Coding Solutions - A Complete solution for python programming
Python program to print memory and processor usage
import os
import psutil
pid = os.getpid()
py = psutil.Process(pid)
mu = (py.memory_info()[0] / 2.**30) * 1000
print('Memory Use(MB):', mu, 'of process id:', pid)
print('CPU Use:',psutil.cpu_percent())
Subscribe to:
Posts (Atom)