Vision

What is your Memory Load Percentage?

by admin on Oct.13, 2009, under c#

Here’s a console utility to print it out:

‘ File: MemLoad.vb
imports System.Runtime.InteropServices

Module module_memoryload

 structure MEMORYSTATUSEX
   public Length as Integer
   public MemoryLoad as Integer
   public TotalPhys as LONG
   public AvailPhys as LONG
   public TotalPageFile as LONG
   public AvailPageFile as LONG
   public TotalVirtual as LONG
   public AvailVirtual as LONG
   public AvailExtendedVirtual as LONG
 End Structure

 Declare Function GlobalMemoryStatusEx lib “kernel32″ _
          (ByRef ms As MEMORYSTATUSEX) As Boolean

 sub main(ByVal args() As String)
   dim ms as new MemoryStatusEx
   ms.Length =  Marshal.Sizeof(ms)
   if GlobalMemoryStatusEx(ms) then
      Console.WriteLine(“- Memory Load: {0}%”, ms.MemoryLoad)
   end if
 end sub

end Module

No comments for this entry yet...

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...