[Mono-dev] New performance counter in Mono to report physical memory size in the machine

jmalcolm malcolm.justin at gmail.com
Sat Apr 17 22:14:49 EDT 2010

Thanks Marek,

Does this live in System.Diagnostics?

Does this mean that the code you posted would fail on Microsoft.NET with an

System.Diagnostics seems like the place Microsoft should have put it.  I am
just surprised to see a Mono extension that does not have it's own assembly
or namespace.  There are probably more that I have managed to miss or simply
forgotten about.

Would something like the following be portable?

--- CUT ---
using System;
using System.Diagnostics;

class app
   static void Main ()
       if (PerformanceCounterCategory.Exists("Mono Memory"))
            var pc = new PerformanceCounter ("Mono Memory", "Total Physical
            Console.WriteLine ("Physical RAM (bytes): {0}", pc.RawValue);
            Console.WriteLine("Cannot detect physical RAM");
--- CUT ---

Sorry if this is a basic question but I am currently on a Windows machine. 
Building Mono from trunk on Windows is not an area of strength for me and I
have not really played around with this part of the framework before.
View this message in context: http://n4.nabble.com/New-performance-counter-in-Mono-to-report-physical-memory-size-in-the-machine-tp2013301p2014604.html
Sent from the Mono - Dev mailing list archive at Nabble.com.

More information about the Mono-devel-list mailing list