Re: How to limit CPU usage in Python

2012-09-27 Thread Jerry Hill
On Thu, Sep 27, 2012 at 12:58 PM, Prasad, Ramit wrote: > On *nix you should just set the appropriate nice-ness and then > let the OS handle CPU scheduling. Not sure what you would do > for Windows--I assume OS X is the same as *nix for this context. On windows, you can also set the priority of a

RE: How to limit CPU usage in Python

2012-09-27 Thread Prasad, Ramit
Paul Rubin wrote: > Rolando Cañer Roblejo writes: > > Is it possible for me to put a limit in the amount of processor usage > > (% CPU) that my current python script is using? Is there any module > > useful for this task? > > One way is check your cpu usage once in a

Re: How to limit CPU usage in Python

2012-09-25 Thread 88888 Dihedral
DPalao於 2012年9月25日星期二UTC+8下午11時13分54秒寫道: > On Jueves septiembre 20 2012 11:12:44 Rolando Cañer Roblejo escribió: > > > Hi all, > > > > > > Is it possible for me to put a limit in the amount of processor usage (% > > > CPU) that my current python script is using? Is there any module useful > >

Re: How to limit CPU usage in Python

2012-09-25 Thread DPalao
On Jueves septiembre 20 2012 11:12:44 Rolando Cañer Roblejo escribió: > Hi all, > > Is it possible for me to put a limit in the amount of processor usage (% > CPU) that my current python script is using? Is there any module useful > for this task? I saw Resource module but I think it is not the mo

Re: How to limit CPU usage in Python

2012-09-24 Thread Tim Roberts
Paul Rubin wrote: > >Tim Roberts: reasons to want to do this might involve a shared host >where excessive cpu usage affects other users; That's what priorities are for. >...or a computer with >limited power consumption, where prolonged high cpu activity causes >thermal or

Re: How to limit CPU usage in Python

2012-09-22 Thread Dwight Hutto
Now also, just thinking theoretically with the knowledge I have, you could underclock(as opposed to overclocking, which is what gamers do), but have never seen that option in BIOS. And maybe there is an option in your OS, google search term 'limiting processes activity cpu usage

Re: How to limit CPU usage in Python

2012-09-22 Thread Dwight Hutto
rites: >> Is it possible for me to put a limit in the amount of processor usage >> (% CPU) that my current python script is using? Is there any module >> useful for this task? > > One way is check your cpu usage once in a while, compare with elapsed > time, and if you

Re: How to limit CPU usage in Python

2012-09-22 Thread Paul Rubin
Rolando Cañer Roblejo writes: > Is it possible for me to put a limit in the amount of processor usage > (% CPU) that my current python script is using? Is there any module > useful for this task? One way is check your cpu usage once in a while, compare with elapsed time, and if your %

Re: How to limit CPU usage in Python

2012-09-22 Thread Tim Roberts
Rolando Cañer Roblejo wrote: > >Is it possible for me to put a limit in the amount of processor usage (% >CPU) that my current python script is using? Why? That's an odd request. It's natural to want to reduce your priority if you want other processes handled first, but an idle CPU is a wasted

Re: How to limit CPU usage in Python

2012-09-21 Thread Ramchandra Apte
nt to end that with ? as I don't know how easy it is to get the > > | external id of the calling process that is to be limited. I presume that > > | can be done by first calling ps (with subprocess) and searching the > > | piped-back output. > > > > If you'

Re: How to limit CPU usage in Python

2012-09-21 Thread Cameron Simpson
On 20Sep2012 12:53, Terry Reedy wrote: | On 9/20/2012 12:46 PM, Terry Reedy wrote: | > On 9/20/2012 11:12 AM, Rolando Cañer Roblejo wrote: | >> Is it possible for me to put a limit in the amount of processor usage (% | >> CPU) that my current python script is using? Is there any module useful | >>

Re: How to limit CPU usage in Python

2012-09-20 Thread Christian Heimes
Am 20.09.2012 17:12, schrieb Rolando Cañer Roblejo: > Hi all, > > Is it possible for me to put a limit in the amount of processor usage (% > CPU) that my current python script is using? Is there any module useful > for this task? I saw Resource module but I think it is not the module I > am lookin

Re: How to limit CPU usage in Python

2012-09-20 Thread Jerry Hill
On Thu, Sep 20, 2012 at 11:12 AM, Rolando Cañer Roblejo wrote: > Hi all, > > Is it possible for me to put a limit in the amount of processor usage (% > CPU) that my current python script is using? Is there any module useful for > this task? I saw Resource module but I think it is not the module I

Re: How to limit CPU usage in Python

2012-09-20 Thread Terry Reedy
On 9/20/2012 12:46 PM, Terry Reedy wrote: On 9/20/2012 11:12 AM, Rolando Cañer Roblejo wrote: Hi all, Is it possible for me to put a limit in the amount of processor usage (% CPU) that my current python script is using? Is there any module useful for this task? I saw Resource module but I think

Re: How to limit CPU usage in Python

2012-09-20 Thread Terry Reedy
On 9/20/2012 11:12 AM, Rolando Cañer Roblejo wrote: Hi all, Is it possible for me to put a limit in the amount of processor usage (% CPU) that my current python script is using? Is there any module useful for this task? I saw Resource module but I think it is not the module I am looking for. Som

How to limit CPU usage in Python

2012-09-20 Thread Rolando Cañer Roblejo
Hi all, Is it possible for me to put a limit in the amount of processor usage (% CPU) that my current python script is using? Is there any module useful for this task? I saw Resource module but I think it is not the module I am looking for. Some people recommend to use nice and cpulimit unix

python CPU usage 99% on ubuntu aws instance using eventlet

2012-02-02 Thread Teddy Toyama
. When I first start running the code, everything seems fine, but I have been noticing that after 10 or 15 hours the cpu usage goes from about 1% to 99+%. At that point I am unable to make further connections to the socketserver. This is the important (hopefully) parts of the code that I'm ru

Re: control CPU usage

2009-09-20 Thread Dave Angel
it to the default handler, resulting the system to be non-responsive. I will try to implement the calculation part in another thread. Then the separate will have 100% CPU usage, hope the task scheduling of Windows works in my favour. (You top-posted this message, putting the whole stream o

Re: control CPU usage

2009-09-20 Thread kakarukeys
gt; >>> pythonw.exe, 22MB, 17MB > >>> searchindexer.exe, 16MB, 19MB > > >>> My first guess is that the script calculated for too long time after > >>> receiving an event before propagating it to the default handler, resulting > >>> the syst

Re: control CPU usage

2009-09-20 Thread Dave Angel
t the calculation part in another thread. Then the separate will have 100% CPU usage, hope the task scheduling of Windows works in my favour. (You top-posted this message, putting the whole stream out of order. So I deleted the history.) All my assumptions about your environment are now invalid.

Re: control CPU usage

2009-09-20 Thread kakarukeys
t before propagating it to the default handler, resulting > > the system to be non-responsive. I will try to implement the calculation > > part in another thread. > > Then the separate will have 100% CPU usage, hope the task scheduling of > > Windows works in my favour. > &

Re: control CPU usage

2009-09-20 Thread Dave Angel
ss is that the script calculated for too long time after receiving an event before propagating it to the default handler, resulting the system to be non-responsive. I will try to implement the calculation part in another thread. Then the separate will have 100% CPU usage, hope the task scheduling of Wi

Re: control CPU usage

2009-09-19 Thread Jiang Fung Wong
lated for too long time after receiving an event before propagating it to the default handler, resulting the system to be non-responsive. I will try to implement the calculation part in another thread. Then the separate will have 100% CPU usage, hope the task scheduling of Windows works in my favour

Re: control CPU usage

2009-09-19 Thread Dave Angel
kakarukeys wrote: Hi, When I am running a loop for a long time, calculating heavily, the CPU usage is at 100%, making the comp not so responsive. Is there a way to control the CPU usage at say 80%? putting a time.sleep(0.x) doesn't seem to help although CPU usage level is reduced, but

Re: control CPU usage

2009-09-19 Thread Sean DiZazzo
On Sep 19, 9:17 am, kakarukeys wrote: > Hi, > > When I am running a loop for a long time, calculating heavily, the CPU > usage > is at 100%, making the comp not so responsive. Is there a way to > control the > CPU usage at say 80%? putting a time.sleep(0.x) doesn't s

control CPU usage

2009-09-19 Thread kakarukeys
Hi, When I am running a loop for a long time, calculating heavily, the CPU usage is at 100%, making the comp not so responsive. Is there a way to control the CPU usage at say 80%? putting a time.sleep(0.x) doesn't seem to help although CPU usage level is reduced, but it's unstable

Re: CPU usage while reading a named pipe

2009-09-13 Thread Nick Craig-Wood
Miguel P wrote: > On Sep 12, 2:54 pm, Ned Deily wrote: > > In article > > , > >  Miguel P wrote: > > > I've been working on parsing (tailing) a named pipe which is the > > > syslog output of the traffic for a rather busy haproxy instance. It's > > > a fair bit of traffic (upto 3k hits/s per ser

Re: CPU usage while reading a named pipe

2009-09-12 Thread Miguel P
On Sep 12, 2:54 pm, Ned Deily wrote: > In article > , >  Miguel P wrote: > > > > > I've been working on parsing (tailing) a named pipe which is the > > syslog output of the traffic for a rather busy haproxy instance. It's > > a fair bit of traffic (upto 3k hits/s per server), but I am finding > >

Re: CPU usage while reading a named pipe

2009-09-12 Thread Ned Deily
In article , Miguel P wrote: > I've been working on parsing (tailing) a named pipe which is the > syslog output of the traffic for a rather busy haproxy instance. It's > a fair bit of traffic (upto 3k hits/s per server), but I am finding > that simply tailing the file in python, without any pro

Re: CPU usage while reading a named pipe

2009-09-12 Thread MRAB
am using 2.6's io module because it's supposed to handle named pipes better. I have commented the deque appending line and it still takes about the same CPU. The system is running Ubuntu 9.04 with kernel 2.6.28 and ext4 (not sure the FS is relevant). Any help bringing down the CPU usage

CPU usage while reading a named pipe

2009-09-12 Thread Miguel P
s io module because it's supposed to handle named pipes better. I have commented the deque appending line and it still takes about the same CPU. The system is running Ubuntu 9.04 with kernel 2.6.28 and ext4 (not sure the FS is relevant). Any help bringing down the CPU usage would be really app

poplib 100% cpu usage

2008-07-16 Thread Oli Schacher
Hi all I wrote a multithreaded script that polls mails from several pop/imap accounts. To fetch the messages I'm using the getmail classes ( http://pyropus.ca/software/getmail/ ) , those classes use the poplib for the real pop transaction. When I run my script for a few hours cpu

Re: finding child cpu usage of a running child

2008-01-28 Thread Matthew_WARREN
had to say, that subject conjoured up an interesting image in my head :) This message and any attachments (the "message") is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord w

Re: finding child cpu usage of a running child

2008-01-26 Thread Karthik Gurusamy
On Jan 25, 11:59 pm, Paddy <[EMAIL PROTECTED]> wrote: > On Jan 26, 5:43 am, Karthik Gurusamy <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > Wondering if there is a way to measure a child process's cpu usage > > (sys and user) when the child is stil

Re: finding child cpu usage of a running child

2008-01-26 Thread Paddy
On Jan 26, 5:43 am, Karthik Gurusamy <[EMAIL PROTECTED]> wrote: > Hi, > > Wondering if there is a way to measure a child process's cpu usage > (sys and user) when the child is still running. I see os.times() > working fine in my system (Linux 2.6.9-42.7.ELsmp), but it giv

finding child cpu usage of a running child

2008-01-25 Thread Karthik Gurusamy
Hi, Wondering if there is a way to measure a child process's cpu usage (sys and user) when the child is still running. I see os.times() working fine in my system (Linux 2.6.9-42.7.ELsmp), but it gives valid data only after the child has exited. When the child is alive, os.times() data for

Re: 100% CPU Usage when a tcp client is disconnected

2007-11-22 Thread Scott David Daniels
Aaron Watters wrote: > On Nov 22, 9:53 am, Tzury Bar Yochay <[EMAIL PROTECTED]> wrote: >> The following is a code I am using for a simple tcp echo server. >> When I run it and then connect to it (with Telnet for example) if I >> shout down the telnet the CPU tops 100% of usage and saty there >> for

Re: 100% CPU Usage when a tcp client is disconnected

2007-11-22 Thread Tzury Bar Yochay
Thank Hrvoje as well -- http://mail.python.org/mailman/listinfo/python-list

Re: 100% CPU Usage when a tcp client is disconnected

2007-11-22 Thread Hrvoje Niksic
Tzury Bar Yochay <[EMAIL PROTECTED]> writes: > The following is a code I am using for a simple tcp echo server. > When I run it and then connect to it (with Telnet for example) if I > shout down the telnet the CPU tops 100% of usage and saty there > forever. Can one tell what am I doing wrong? I

Re: 100% CPU Usage when a tcp client is disconnected

2007-11-22 Thread Tzury Bar Yochay
> data = "dummy" > while data: > ... Thanks Alot -- http://mail.python.org/mailman/listinfo/python-list

Re: 100% CPU Usage when a tcp client is disconnected

2007-11-22 Thread Aaron Watters
On Nov 22, 9:53 am, Tzury Bar Yochay <[EMAIL PROTECTED]> wrote: > The following is a code I am using for a simple tcp echo server. > When I run it and then connect to it (with Telnet for example) if I > shout down the telnet the CPU tops 100% of usage and saty there > forever > def handle(s

100% CPU Usage when a tcp client is disconnected

2007-11-22 Thread Tzury Bar Yochay
The following is a code I am using for a simple tcp echo server. When I run it and then connect to it (with Telnet for example) if I shout down the telnet the CPU tops 100% of usage and saty there forever. Can one tell what am I doing wrong? #code.py import SocketServer class MyServer(SocketServ

Re: track cpu usage of linux application

2007-05-15 Thread Fabian Braennstroem
Hi, thanks to both! I will take a look at the proc files! * James T. Dennis <[EMAIL PROTECTED]> wrote: > Fabian Braennstroem <[EMAIL PROTECTED]> wrote: >> Hi, > >> I would like to track the cpu usage of a couple of >>programs using python. Maybe it

Re: track cpu usage of linux application

2007-05-14 Thread James T. Dennis
Fabian Braennstroem <[EMAIL PROTECTED]> wrote: > Hi, >I would like to track the cpu usage of a couple of >programs using python. Maybe it works somehow with >piping 'top' to python read the cpu load for a greped >application and clocking the the fir

Re: track cpu usage of linux application

2007-05-14 Thread Zed A. Shaw
On Mon, 14 May 2007 20:56:20 + Fabian Braennstroem <[EMAIL PROTECTED]> wrote: > Hi, > > I would like to track the cpu usage of a couple of > programs using python. Maybe it works somehow with > piping 'top' to python read the cpu load for a greped

track cpu usage of linux application

2007-05-14 Thread Fabian Braennstroem
Hi, I would like to track the cpu usage of a couple of programs using python. Maybe it works somehow with piping 'top' to python read the cpu load for a greped application and clocking the the first and last appearence. Is that a good approach or does anyone have

Re: CPU usage.

2007-05-09 Thread Gabriel Genellina
En Wed, 09 May 2007 02:58:45 -0300, Navid Parvini <[EMAIL PROTECTED]> escribió: > I want to get the CPU usage in my code. > Is there any module in Python to get it? > Also I want to get in on Windows and Linux. On Windows you can use WMI; Tim Golden made an excellent libra

CPU usage.

2007-05-08 Thread Navid Parvini
Dear All, I want to get the CPU usage in my code. Is there any module in Python to get it? Also I want to get in on Windows and Linux. Thank you in advance. Navid - Ahhh...imagining that irresistible "new car" smell? Check outn

Re: CPU usage

2007-05-08 Thread Tim Golden
Navid Parvini wrote: > I want to get the CPU usage in my code. > Is there any module in Python to get it? What Operating System are you on? TJG -- http://mail.python.org/mailman/listinfo/python-list

CPU usage

2007-05-08 Thread Navid Parvini
Dear All, I want to get the CPU usage in my code. Is there any module in Python to get it? Would you please help me? Thank you in advance. Navid - Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games.-- http

a question about MS Windows Clipboard to decrease cpu usage.

2006-10-22 Thread [EMAIL PROTECTED]
hello, I want to record the content of windows'clipboad, after search c.l.p. I got some practical answer such as http://groups.google.com/group/comp.lang.python/browse_thread/thread/57318b87e33e79b0/a7c5d5fcbd4eb58a I have create my small script, it can get clipboard preliminary. but now i had a tr

Re: Get CPU usage of a single process in Windows

2006-09-12 Thread Gerrit Muller
[Tim Golden] now I only have to find some time to play around... thanks, Gerrit -- Gaudi systems architecting: -- http://mail.python.org/mailman/listinfo/python-list

RE: Get CPU usage of a single process in Windows

2006-09-12 Thread Tim Golden
[Gerrit Muller] | If you have a working example of CPU usage could you post the | result? I would be interested. OK. Here's a workingish example, cut down from the link I posted earlier. This one was designed to work with Win2K which I was using at the time. For WinXP and later, there&#x

RE: Get CPU usage of a single process in Windows

2006-09-12 Thread Tim Golden
[Gerrit Muller] | | Tim Golden wrote: | > WMI can probably do the trick. I'm fairly sure I've got an example | somewhere, but I can't lay my hands on it at the mo. | If you have a working example of CPU usage could you post the | result? I | would be interested. I haven

Re: Get CPU usage of a single process in Windows

2006-09-12 Thread Gerrit Muller
Tim Golden wrote: <...snip...> >>This should be possible as Taskmanager tracks CPU usage for every >>process... Anyone know how this can be done? >> > > WMI can probably do the trick. If you can find something on Google > for wmi cpu usage (or something simi

Re: Get CPU usage of a single process in Windows

2006-09-08 Thread Tim Roberts
Tor Erik <[EMAIL PROTECTED]> wrote: > >This should be possible as Taskmanager tracks CPU usage for every >process... Anyone know how this can be done? I answered this in the python-win32 mailing list. Task manager and perfmon do this by using the performance counter APIs. Python

Re: Get CPU usage of a single process in Windows

2006-09-08 Thread Tim Golden
Tor Erik wrote: > Hi, > > This should be possible as Taskmanager tracks CPU usage for every > process... Anyone know how this can be done? > WMI can probably do the trick. If you can find something on Google for wmi cpu usage (or something similar) then translation to Python'

Get CPU usage of a single process in Windows

2006-09-08 Thread Tor Erik
Hi, This should be possible as Taskmanager tracks CPU usage for every process... Anyone know how this can be done? regards -- http://mail.python.org/mailman/listinfo/python-list

Long running Script stops responding, CPU usage increases

2006-02-28 Thread Jeff Quandt
Title: Long running Script stops responding, CPU usage increases This is running Python 2.3 on windows 2003/windows xp. I have written a script to display and filter the Win32 event log in a scrolling list to the command line (it also does some summary tasks).  It uses the

ReadEventLog doesn't return, CPU usage increases

2006-02-24 Thread Jeff Quandt
Title: ReadEventLog doesn't return, CPU usage increases This is running Python 2.3 on windows 2003/windows xp. I have written a script to display and filter the Win32 event log in a scrolling list to the command line (it also does some summary tasks).  It uses the win32evtlog.ReadEve

Re: cpu usage limit

2005-05-29 Thread garabik-news-2005-05
[EMAIL PROTECTED] wrote: > I understand, that what I suggest does not solve the problem you want, > but.. > > Why do you want to restrict CPU usage to 30%? In Windows I run CPU there might be three reasons: 1) less power consumed (notebooks, PDA's) 2) less heat from CPU 3

Re: cpu usage limit

2005-05-27 Thread elbertlev
I understand, that what I suggest does not solve the problem you want, but.. Why do you want to restrict CPU usage to 30%? In Windows I run CPU intesive therads on IDLE priority, while interfacand/or communication threads run on normal. This gives me best of two worlds: 1. I use 100% CPU (good

Re: cpu usage limit

2005-05-27 Thread Peter Hansen
rbt wrote: > [EMAIL PROTECTED] wrote: >> finished = False >> while not finished: > > Why don't you just write 'while True'??? 'while not false' is like > saying 'I am not unemployed by Microsoft' instead of saying 'I am > employed by Microsoft'. It's confusing, complex and unnecessary. Lawyers

Re: cpu usage limit

2005-05-27 Thread Paul Rubin
"mmf" <[EMAIL PROTECTED]> writes: > How can I make sure that a Python process does not use more that 30% of > the CPU at any time. I only want that the process never uses more, but > I don't want the process being killed when it reaches the limit (like > it can be done with resource module). > > C

Re: cpu usage limit

2005-05-27 Thread Grant Edwards
On 2005-05-27, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >>> How can I make sure that a Python process does not use more that 30% of >>> the CPU at any time. I only want that the process never uses more, but >>> I don't want the process being killed when it reaches the limit (like >>> it can be

Re: cpu usage limit

2005-05-27 Thread rbt
[EMAIL PROTECTED] wrote: > rbt <[EMAIL PROTECTED]> wrote: > >>mf wrote: >> >>>Hi. >>> >>>My problem: >>>How can I make sure that a Python process does not use more that 30% of >>>the CPU at any time. I only want that the process never uses more, but >>>I don't want the process being killed when it

Re: cpu usage limit

2005-05-27 Thread Markus Franz
> Are you looping during a cpu intensive task? If so, make it sleep a bit > like this: > > for x in cpu_task: > time.sleep(0.5) > do(x) No, I don't use an intensive loop. I have about 1200 lines of code inside a process - is there nothing like xyz.setlimit(xyz.cpu, 0.30) ??? Thank. M

Re: cpu usage limit

2005-05-27 Thread garabik-news-2005-05
rbt <[EMAIL PROTECTED]> wrote: > > mf wrote: >> Hi. >> >> My problem: >> How can I make sure that a Python process does not use more that 30% of >> the CPU at any time. I only want that the process never uses more, but >> I don't want the process being killed when it reaches the limit (like >> it

Re: cpu usage limit

2005-05-27 Thread rbt
mf wrote: > Hi. > > My problem: > How can I make sure that a Python process does not use more that 30% of > the CPU at any time. I only want that the process never uses more, but > I don't want the process being killed when it reaches the limit (like > it can be done with resource module). > > C

cpu usage limit

2005-05-27 Thread mmf
Hi. My problem: How can I make sure that a Python process does not use more that 30% of the CPU at any time. I only want that the process never uses more, but I don't want the process being killed when it reaches the limit (like it can be done with resource module). Can you help me? Thanks in ad