Click or drag to resize

MemoryUsageInfoProvider Constructor

Initializes a new instance of the MemoryUsageInfoProvider class.

Namespace:  Xcalibur.WMI.Hardware.Memory
Assembly:  Xcalibur.WMI (in Xcalibur.WMI.dll) Version: 3.0.0.0 (3.0.1.0)
Syntax
public MemoryUsageInfoProvider(
	ManagementScope ms
)

Parameters

ms
Type: System.ManagementManagementScope
The management scope.
Examples
C#
 1// Main
 2private static void Main()
 3{
 4    // Make a connection to the local machine
 5    const string computer = ".";
 6    var managementScope = new ManagementScope($@"\\{computer}\root\cimv2", new ConnectionOptions
 7    {
 8        Impersonation = ImpersonationLevel.Impersonate,
 9        Authentication = AuthenticationLevel.Connect
10    });
11    managementScope.Connect();
12
13    // Memory Usage Info Provider
14    var provider = new MemoryUsageInfoProvider(managementScope);
15
16    // Fetch data
17    provider.Refresh();
18
19    // Print
20    foreach (var info in provider.Results)
21    {
22        Console.WriteLine($"Available Bytes: \t{info.AvailableBytes:n0}");
23        Console.WriteLine($"Commit Bytes: \t\t{info.CommittedBytes:n0}");
24        Console.WriteLine($"Commit Limit: \t\t{info.CommitLimit:n0}");
25        Console.WriteLine($"Cache Bytes: \t\t{info.CacheBytes:n0}");
26        Console.WriteLine($"Cache Bytes Peak: \t{info.CacheBytesPeak:n0}");
27        Console.WriteLine($"Pool-Paged Bytes: \t{info.PoolPagedBytes:n0}");
28        Console.WriteLine($"Non Pool-Paged Bytes: \t{info.PoolNonpagedBytes:n0}");
29    }
30
31    // Read
32    Console.Read();
33}
34
35/* Results: 
36 * 
37 * Available Bytes:        22,161,780,736
38 * Commit Bytes:           16,157,876,224
39 * Commit Limit:           39,395,987,456
40 * Cache Bytes:            284,540,928
41 * Cache Bytes Peak:       898,146,304
42 * Pool-Paged Bytes:       1,346,035,712
43 * Non Pool-Paged Bytes:   1,908,195,328
44 * 
45 */
See Also