Hi,
Thanks for replying. I have looked at that class, but I cant figure out how
this class is able to read available memory. There seems to be no
persformanceCounterType suitable for my use.
I have declared the following counter, with some shortages pointed out in
comments
PerformanceCounter PC = new PerformanceCounter("Memory", "GetMemory");
if(!PerformanceCounterCategory.Exists("Orders")) {
CounterCreationData mem = new CounterCreationData();
mem.CounterName = "mem";
mem.CounterType = PerformanceCounterType.?; // What kind of
PerformanceCounterType should I use
CounterCreationData memAvailable = new CounterCreationData();
memAvailable.CounterName = "Availabe memory";
memAvailable.CounterType = PerformanceCounterType.?; // What kind of
CounterType should I use
CounterCreationDataCollection ccds = new
CounterCreationDataCollection();
ccds.Add(memAvailable);
ccds.Add(mem);
PerformanceCounterCategory.Create("Memory","Retrei ves available
memory",ccds);
}
else
{
Console.WriteLine("Category exists - Memory");
}
What should I do after this? to gather and retrive memory info? I assume
that I could use PC.NextValue to retrieve next availabe samle in this
performance counter. Is my assumption right?
regards
Kovan
"Allan Taunt" <al*************@NO-hotmail-SPAM.com> wrote in message
news:e0**************@TK2MSFTNGP09.phx.gbl...
Hi Kovan,
You could use the PerformanceCounter class from System.Diagnostics.
Cheers,
Allan.
"Kovan Akrei" <ko****@ifi.uio.no> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... Hi,
I wonder if it is possible to get hold of avaiable memory (only RAM) on
a machine through .Net class library? I do not want to call windws API.
I would like to use this to decide how many alive threads my program
could have each time the program runs. I use a number of threads in a
simulation tool.
Many thanks in advance.
Best regards
Kovan Akrei