File indexing completed on 2024-11-03 06:41:20
0001 #!/usr/bin/python 0002 0003 import psutil 0004 0005 while True: 0006 cpu_percents = str(psutil.cpu_percent(interval=0.5, percpu=True)) 0007 line = str(cpu_percents)[1:-1] 0008 print line 0009 0010 datafile = open("cpuData.txt", "a") 0011 datafile.write(line + "\n") 0012 datafile.close()