Get CPU usage of a single process in Windows

Discussion in 'Python' started by Tor Erik, Sep 8, 2006.

  1. Tor Erik

    Tor Erik Guest

    Hi,

    This should be possible as Taskmanager tracks CPU usage for every
    process... Anyone know how this can be done?

    regards
    Tor Erik, Sep 8, 2006
    #1
    1. Advertising

  2. Tor Erik

    Tim Golden Guest

    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's
    usually quite easy. I'm fairly sure I've got an example somewhere, but
    I can't lay my hands on it at the mo.

    TJG
    Tim Golden, Sep 8, 2006
    #2
    1. Advertising

  3. Tor Erik

    Tim Roberts Guest

    Tor Erik <> 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-Win32 includes an
    interface for that (import win32pdh), but I've never used it.
    --
    - Tim Roberts,
    Providenza & Boekelheide, Inc.
    Tim Roberts, Sep 9, 2006
    #3
  4. 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 similar) then translation to Python's
    > usually quite easy. I'm fairly sure I've got an example somewhere, but
    > I can't lay my hands on it at the mo.
    >
    > TJG
    >

    Tim Golden's general documentation/examples about WMI are at:
    <http://tgolden.sc.sabren.com/python/wmi.html>.

    If you have a working example of CPU usage could you post the result? I
    would be interested.

    kind regards, Gerrit Muller

    --
    Gaudi systems architecting:
    <http://www.gaudisite.nl/>
    Gerrit Muller, Sep 12, 2006
    #4
    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. Tim Golden
    Replies:
    1
    Views:
    865
    Gerrit Muller
    Sep 12, 2006
  2. OtisUsenet
    Replies:
    3
    Views:
    547
    Tom Forsmo
    Nov 27, 2006
  3. hvt
    Replies:
    0
    Views:
    1,191
  4. hvt
    Replies:
    0
    Views:
    1,447
  5. Joe Van Dyk
    Replies:
    5
    Views:
    260
Loading...

Share This Page