Code: Select all
r←GlobalMemoryStatusEx;get;rc
⍝ See https://msdn.microsoft.com/en-us/library/windows/desktop/aa366770(v=vs.85).aspx
'get'⎕NA'U kernel32∣GlobalMemoryStatusEx ={U U {U U} {U U} {U U} {U U} {U U} {U U} {U U}}'
(rc r)←get⊂64 0,7⍴⊂0 0
:If rc≠1 ⋄ (⍕rc)⎕SIGNAL 11 ⋄ :EndIf
(2↓r)←1E¯9×(2*32)⊥∘⌽¨2↓r ⍝ Gigabytes
r←'Load(%)' 'TotalPhys' 'AvailPhys' 'TotalPageFile' 'AvailPageFile' 'TotalVirtual' 'AvailVirtual',⍪1↓¯1↓r
Example usage and output:
GlobalMemoryStatusEx
Load(%) 72
TotalPhys 16.9696215
AvailPhys 4.730630144
TotalPageFile 25.35632486
AvailPageFile 13.19555891
TotalVirtual 8796.092891
AvailVirtual 8795.017429