[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: How to get memory and CPU status of a particular process

Chris Rebert

2/23/2010 7:04:00 AM

> On Tue, Feb 23, 2010 at 9:18 AM, R. P. Janaka <rpjanaka@gmail.com> wrote:
>> Hi all,
>>
>> Is there a way to get system memory consumption and CPU consumption in a
>> platform independent way, using python...?
>>
>> Basically my requirement is, get the memory status and CPU status of a
>> particular process. If there is a way to get memory info and CPU info by
>> just giving the process ID, that is exactly what I need to do :)
>> Is this possible with python..?

Given Turing-completeness, one should more precisely ask whether there
is already a library for doing something in Python rather than whether
something is possible with Python.

On Mon, Feb 22, 2010 at 10:12 PM, R. P. Janaka <rpjanaka@gmail.com> wrote:
> Please can anyone help me..??

It is generally customary to wait /at least/ one day before pinging on
one's question again.

If you were to have searched PyPI (http://pypi....), you would
have found psutil, which seems to fit your bill:
http://code.google.com...

Cheers,
Chris
--
This completes today's Netiquette lesson.
http://blog.re...
2 Answers

Paul Rudin

2/23/2010 7:17:00 AM

0

Chris Rebert <clp2@rebertia.com> writes:

>> On Tue, Feb 23, 2010 at 9:18 AM, R. P. Janaka <rpjanaka@gmail.com> wrote:
>>> Hi all,
>>>
>>> Is there a way to get system memory consumption and CPU consumption in a
>>> platform independent way, using python...?
>>>
>>> Basically my requirement is, get the memory status and CPU status of a
>>> particular process. If there is a way to get memory info and CPU info by
>>> just giving the process ID, that is exactly what I need to do :)
>>> Is this possible with python..?
>
> Given Turing-completeness, one should more precisely ask whether there
> is already a library for doing something in Python rather than whether
> something is possible with Python.

Turing-completeness is irrelevant to questions like getting memory and
CPU info for a process. These are not issues of computability...

Chris Rebert

2/23/2010 7:28:00 AM

0

On Mon, Feb 22, 2010 at 11:16 PM, Paul Rudin <paul.nospam@rudin.co.uk> wrote:
> Chris Rebert <clp2@rebertia.com> writes:
>>> On Tue, Feb 23, 2010 at 9:18 AM, R. P. Janaka <rpjanaka@gmail.com> wrote:
>>>> Is there a way to get system memory consumption and CPU consumption in a
>>>> platform independent way, using python...?
>>>>
>>>> Basically my requirement is, get the memory status and CPU status of a
>>>> particular process. If there is a way to get memory info and CPU info by
>>>> just giving the process ID, that is exactly what I need to do :)
>>>> Is this possible with python..?
>>
>> Given Turing-completeness, one should more precisely ask whether there
>> is already a library for doing something in Python rather than whether
>> something is possible with Python.
>
> Turing-completeness is irrelevant to questions like getting memory and
> CPU info for a process. These are not issues of computability...

True, but given that it is possible to access most *nix APIs from
Python and win32all provides what I understand to be extensive access
to the Win32 API from Python, cross-platform coding is almost always
possible in Python. You might have to manually deal with each case
yourself though. (More technically, I suppose that's being
multi-platform with relatively easy DIY cross-platform).

Cheers,
Chris
--
http://blog.re...