Esempio n. 1
0
        public void TestGetCoreCountData()
        {
#if !(NETCOREAPP2_0)
            var windowsSystemInfo = new WMISystemInfo();
            var wmiCore           = windowsSystemInfo.GetCoreCount(out var wmiPhysicalProcs);
            Console.WriteLine("WMI:  {0} processor(s) and {1} cores", wmiPhysicalProcs, wmiCore);
#endif

            var wpsi = new WindowsSystemInfo();
            Console.WriteLine("PInv: {0} processor(s) and {1} cores", wpsi.GetProcessorPackageCount(), wpsi.GetCoreCount());
            Console.WriteLine("PInv NUMA Nodes: {0}", wpsi.GetNumaNodeCount());
            Console.WriteLine("PInv Logical Cores: {0}", wpsi.GetLogicalCoreCount());
        }
Esempio n. 2
0
        public void TestGetTotalMemory()
        {
#if !(NETCOREAPP2_0)
            var windowsSystemInfo = new WMISystemInfo();
            var wmiMem            = windowsSystemInfo.GetTotalMemoryMB();
            Console.WriteLine("WMI Total memory:  {0:F2} MB", wmiMem);
#endif
            // Use P/Invoke to access kernel32.dll
            var wpsi    = new WindowsSystemInfo();
            var pinvMem = wpsi.GetTotalMemoryMB();
            Console.WriteLine("PInv Total memory: {0:F2} MB", pinvMem);

#if !(NETCOREAPP2_0)
            Assert.AreEqual(wmiMem, pinvMem, 0.001);
#endif
        }
Esempio n. 3
0
        public void TestGetCoreCount()
        {
#if !(NETCOREAPP2_0)
            var windowsSystemInfo = new WMISystemInfo();
            var wmiCore           = windowsSystemInfo.GetCoreCount(out var wmiPhysicalProcs);
            Console.WriteLine("WMI:  {0} processor(s) and {1} cores", wmiPhysicalProcs, wmiCore);
#endif
            // Use P/Invoke to access kernel32.dll
            var wpsi          = new WindowsSystemInfo();
            var pinvCore      = wpsi.GetCoreCount();
            var pirvProcCount = wpsi.GetProcessorPackageCount();

            Console.WriteLine("PInv: {0} processor(s) and {1} cores", pirvProcCount, pinvCore);

#if !(NETCOREAPP2_0)
            Assert.AreEqual(wmiPhysicalProcs, pirvProcCount);
            Assert.AreEqual(wmiCore, pinvCore);
#endif
        }