How is Memory Utilization calculated for Windows servers?

How is Memory Utilization calculated for Windows servers?

Memory Calculation


We run memory.vbs in WMI mode to get memory details. Here is a sample output:


memory.vbs

Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
Type:                         TotalSize:       Used:
PhysicalMemory       8344472       5625448
VirtualMemory          16687084     6525100
SwapMemory           5505024      133964
FreePhysicalMemory 2654

Calculation : 


PhysicalMemUtilization in MB
PhysicalMemUtilization in %
VirtualMemUtilization in MB
VirtualMemUtilization in %

SwapMemUtilization in MB

SwapMemUtilization in %

Free Physical Memory in MB
Expression 
curValue / (1024)
where,
curValue = 4th line and 3rd token
(100*(curValue/maxValue))
where,
curValue = 4th line and 3rd token
maxValue = 4th line and 2nd token
curValue/(1024)
where,
curValue = 5th line and 3rd token
(100*(curValue/maxValue))
where,
curValue = 5th line and 3rd token
maxValue = 5th line and 2nd token
curValue/1024
where,
curValue = 6th line and 3rd token
(100*(curValue/maxValue))
where,
curValue = 6th line and 3rd token
maxValue = 6th line and 2nd token
curValue
where,
curValue = 7th line and 2nd token
Calculation
5625448 / 1024 = 5493
(100*(5625448/8344472)) = 67.41%
6525100 / 1024 = 6372
(100*(6525100/16687084)) = 39.10%
133964 / 1024 = 131
(100*(133964/5505024)) = 2.43%
2654