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

Discussion in 'Python' started by Chris Rebert, Feb 23, 2010.

  1. Chris Rebert

    Chris Rebert Guest

    > On Tue, Feb 23, 2010 at 9:18 AM, R. P. Janaka <> 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 <> 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.python.org), you would
    have found psutil, which seems to fit your bill:
    http://code.google.com/p/psutil/

    Cheers,
    Chris
    --
    This completes today's Netiquette lesson.
    http://blog.rebertia.com
    Chris Rebert, Feb 23, 2010
    #1
    1. Advertising

  2. Chris Rebert

    Paul Rudin Guest

    Chris Rebert <> writes:

    >> On Tue, Feb 23, 2010 at 9:18 AM, R. P. Janaka <> 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...
    Paul Rudin, Feb 23, 2010
    #2
    1. Advertising

  3. Chris Rebert

    Chris Rebert Guest

    On Mon, Feb 22, 2010 at 11:16 PM, Paul Rudin <> wrote:
    > Chris Rebert <> writes:
    >>> On Tue, Feb 23, 2010 at 9:18 AM, R. P. Janaka <> 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.rebertia.com
    Chris Rebert, Feb 23, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gilles Lenfant

    Get the status of a process

    Gilles Lenfant, Nov 28, 2003, in forum: Python
    Replies:
    2
    Views:
    310
    Gilles Lenfant
    Nov 28, 2003
  2. Tor Erik
    Replies:
    3
    Views:
    6,549
    Gerrit Muller
    Sep 12, 2006
  3. Tim Golden
    Replies:
    1
    Views:
    867
    Gerrit Muller
    Sep 12, 2006
  4. pavunkumar

    How , system cpu and user cpu times calculates

    pavunkumar, Feb 27, 2009, in forum: C Programming
    Replies:
    1
    Views:
    338
  5. Luki
    Replies:
    1
    Views:
    72
Loading...

Share This Page