Announcement

Collapse
No announcement yet.

To list top CPU usage processes.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • To list top CPU usage processes.

    Use below script to get top CPU usage processes,

    Note: CPU usage refers to how longer a process using CPU.


    Code:
    import os;
    load=os.popen('wmic cpu get loadpercentage /format:list').read();
    print(load);
    print('Top cpu consuming processes \n');
    process=os.popen('tasklist /v /FI "CPUTIME gt 00:03:00"  | sort /R /+148').readlines();
    try:
       for i in range(1,7,1):
           print (process[i]);
    except:
        print("Finished");


    sample output would be,

    Click image for larger version

Name:	top_cpu_consuming_processes.jpg
Views:	1
Size:	50.5 KB
ID:	4786

Working...
X