Programatically summing all the processes on the host machine.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob

    #1

    Programatically summing all the processes on the host machine.

    Greetings,

    IF one wanted to get the memory utilization just like the windows task manager
    does .. what do you need to sum? .. if I add together all the processes I'm
    still short ..

    my snippet

    private Int64 total_mem_usage ()
    {
    Int64 memUsed = 0;

    System.Diagnost ics.Process[] PrsArr = System.Diagnost ics.Process.Get Processes();
    foreach (System.Diagnos tics.Process p in PrsArr)
    {
    memUsed += p.WorkingSet64;
    }

    return memUsed;
    }


    ---------------------------------------------
    [Sam Samson] - There is no greater folly than fixed price quoting.


  • Patrick Steele

    #2
    Re: Programatically summing all the processes on the host machine.

    In article <ece03a78815d8c 9b38f43dca818@n ews.microsoft.c om>,
    nospamsam@nospa m.com.au says...
    IF one wanted to get the memory utilization just like the windows task manager
    does .. what do you need to sum? .. if I add together all the processes I'm
    still short ..
    >
    my snippet
    >
    private Int64 total_mem_usage ()
    {
    Int64 memUsed = 0;
    >
    System.Diagnost ics.Process[] PrsArr = System.Diagnost ics.Process.Get Processes();
    foreach (System.Diagnos tics.Process p in PrsArr)
    {
    memUsed += p.WorkingSet64;
    }
    >
    return memUsed;
    }
    WMI might work:

    http://tinyurl.com/397m2b
    "In this article, Steve demonstrates how to get memory size usage using
    WMI and .NET 2.0. The information returned is the same as listed in Task
    Manager."

    --
    Patrick Steele (patrick@mvps.o rg)

    Comment

    Working...