Identify the largest number

0

I'm doing resource tracking software and I'm having a hard time getting it to identify the most.

public string max()
    {

        System.Diagnostics.Process[] ieProcs = Process.GetProcessesByName("devenv");
        double avvv = 0;
        string abi = null;
        if (ieProcs.Length > 0)
        {
            foreach (System.Diagnostics.Process p in ieProcs)
            {

                String virtualMem = p.VirtualMemorySize64.ToString();
                String physicalMem = p.WorkingSet64.ToString();
                String cpu = p.TotalProcessorTime.ToString();
                abi = physicalMem;
            }
        }

        avvv = double.Parse(abi);
        avvv = avvv * 0.001 / 1024;
        return avvv.ToString();
    }

above the code I would like to capture the largest number, this is a code that monitors the use of process ram memory, just as does the Windows task manager, but I want to get the peak at the moment the process uses the largest branch of ram. The values are dynamic and whenever I change to a larger one I want it to change at the maximum value.

That way I'd like it to display.

    
asked by anonymous 16.04.2016 / 15:35

1 answer

0

See if this resolves:

private static double Max_avvv=0;
public string max()
{

    System.Diagnostics.Process[] ieProcs = Process.GetProcessesByName("devenv");
    double avvv = 0;
    string abi = null;
    if (ieProcs.Length > 0)
    {
        foreach (System.Diagnostics.Process p in ieProcs)
        {

            String virtualMem = p.VirtualMemorySize64.ToString();
            String physicalMem = p.WorkingSet64.ToString();
            String cpu = p.TotalProcessorTime.ToString();
            abi = physicalMem;
        }
    }

    avvv = double.Parse(abi);
    avvv = avvv * 0.001 / 1024;

    if(Max_avvv<avvv)
       Max_avvv=avvv;

    return Max_avvv.ToString();
}
    
17.04.2016 / 15:08