public static void getallmemoryusage(string processName)
{
Process[] pprocessName = Process.GetProcessesByName(processName);//.GetCurrentProcess().ProcessName;
var counter = new PerformanceCounter("Process", "Working Set - Private", processName);
privateMemeory = string.Format("Private memory: {0}k", counter.NextValue() / 1024);
}
Some problems here:
I have a variable Process[] pprocessName but i never use it.
The it is now i'm getting a value that is not the same one in the task manager.
In the task manager i see 192.6MB in my program i see 197232. Now i started playing the game use the application(process) now in task manager it show: 219.0MB in my program 224304.
Why it's now the same values and what should i do with the Process[] pprocessName variable ? Also how do i show the percentage/s for the application(process) like it show it in task manager ?
I want that this method will return the same value of memory usage and same percentage value like in the task manager.