opkdn.blogg.se

Linux track memory usage
Linux track memory usage













linux track memory usage

The program quits when you hit Ctrl+C or when the process is killed. You can then redirect its output to a file in order to import it into a spreadsheet later ( python log.py 9391 > firefox_log.txt) and import the data into a spreadsheet selecting Tab as your separator. It will print the cpu usage and ram usage in per cent two times a second: %CPU %MEM You first need to find out the process id of the program you want to monitor, then you can run the script with the PID as an argument: python log.py 3912 If not len(sys.argv) = 2 or not all(i in string.digits for i in sys.argv):

linux track memory usage

Return (float(d.split()), float(d.split())) if d else None This simple python script should do what you want: import timeĭ = [i for i in commands.getoutput("ps aux").split("\n")















Linux track memory usage