Get the process of working with a private working set

Trying to get a private workflow programmatically.

Currently, I can get a working set without problems, but the problem is getting a personal working set.

Here's the method:

private void GetProcessesForServer(string serverName)
{
    var runningProcesses = new Process[0];

    try
    {
        runningProcesses = Process.GetProcesses(serverName);

    }
    catch (Exception e)
    {
        ResultsPanel.Controls.Add(new Label { Text = string.Format("There was an error: {0}", e.GetBaseException().Message) });
    }

    IOrderedEnumerable<CustomProcess> processes = runningProcesses
        .Select(process => new CustomProcess(process.Id, process.ProcessName, (process.WorkingSet64 / 1024)))
        .ToList()
        .OrderBy(process => process.ProcessName);

    if (processes.Count() > 0)
        ResultsLabel.Text = string.Format("Current running processes on {0}", ServerNamesDropDown.SelectedItem.Text);

    ResultsGridView.DataSource = processes;
    ResultsGridView.DataBind();
}

So, I pass the server name, and then try to get all running processes for this server, and then bind the list of processes to the grid view. Everything works without any problems, however I need to get a private working set, similar to what you see in the Windows task manager, and not a full working set.

Thanks a lot Tim

+3
source share
1 answer

Windows Vista " - " "" (. msdn).

, , System.Diagonstics.PerformanceCounter .

, "ID Process" . : , "ID Process" - , " - ".

: , System.Diagonstics.PerformanceCounterCategory.ReadCategory(), /.

: codeproject, , XP/2000, . , ; -)

2. fooobar.com/questions/706042/....

+2

Source: https://habr.com/ru/post/1765755/


All Articles