Python Forum
Trying to find a more cpu effecent way of doing this.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying to find a more cpu effecent way of doing this.
#1
def KillProcess(list):
    while(True):
        for program in list:
            for proc in psutil.process_iter():
                if proc.name() == program:
                    proc.kill()
                    time.sleep(3)
This does what I need it to but I am using about 33% of the cpu. I am trying to find different ways of doing this that might be easy on my system.
Reply


Messages In This Thread
Trying to find a more cpu effecent way of doing this. - by rawrmonster - Dec-16-2017, 06:51 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020