memoru usage of process

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jacek Pop³awski

    #1

    memoru usage of process

    I need to know how much memory uses child process (after
    subprocess.Pope n), so I want function:

    get_memory_usag e(pid)

    I found two ways:

    - call "ps" and analyze its output - this is not portable (different
    output on Linux, Cygwin and QNX)

    - use resource.getrus age - but it works for self/children, not for
    single process with given pid

    Do you know any ideas how to do it in Python?
  • MrJean1

    #2
    Re: memoru usage of process

    On Linux, this may work for you

    <http://aspn.activestat e.com/ASPN/Cookbook/Python/Recipe/286222>

    /Jean Brouwers



    Jacek Poplawski wrote:[color=blue]
    > I need to know how much memory uses child process (after
    > subprocess.Pope n), so I want function:
    >
    > get_memory_usag e(pid)
    >
    > I found two ways:
    >
    > - call "ps" and analyze its output - this is not portable (different
    > output on Linux, Cygwin and QNX)
    >
    > - use resource.getrus age - but it works for self/children, not for
    > single process with given pid
    >
    > Do you know any ideas how to do it in Python?[/color]

    Comment

    • Jacek PopÅ‚awski

      #3
      Re: memoru usage of process

      MrJean1 wrote:[color=blue]
      > <http://aspn.activestat e.com/ASPN/Cookbook/Python/Recipe/286222>[/color]

      Yes, I have seen it in archive, but I was searching for Python way, and
      it's not Python related at all (it is just reading system file), and
      won't work on QNX.

      Comment

      • MrJean1

        #4
        Re: memoru usage of process

        What do you mean by 'Python way' and 'not related to Python'?

        How is parsing the output of 'ps' different from the method used in
        recipe 286222?

        /Jean Brouwers

        Comment

        Working...