コード例 #1
0
        /// <summary>
        /// Validate the <see cref="SystemPerformanceInformation" /> returned from the tests.
        /// </summary>
        /// <param name="systemPerfInfo">The <see cref="SystemPerformanceInformation" /> to validate.</param>
        private static void ValidateSystemPerm(SystemPerformanceInformation systemPerfInfo)
        {
            // Check some known things about this response.
            Assert.AreEqual(systemPerfInfo.AvailablePages, 369054U);
            Assert.AreEqual(systemPerfInfo.CommitLimit, 784851U);
            Assert.AreEqual(systemPerfInfo.CommittedPages, 322627U);
            Assert.AreEqual(systemPerfInfo.CpuLoad, 1U);
            Assert.AreEqual(systemPerfInfo.IoOtherSpeed, 3692U);
            Assert.AreEqual(systemPerfInfo.IoReadSpeed, 36U);
            Assert.AreEqual(systemPerfInfo.IoWriteSpeed, 6480U);
            Assert.AreEqual(systemPerfInfo.NonPagedPoolPages, 42504U);
            Assert.AreEqual(systemPerfInfo.PageSize, 4096U);
            Assert.AreEqual(systemPerfInfo.PagedPoolPages, 30697U);
            Assert.AreEqual(systemPerfInfo.TotalInstalledKb, 1048592U);
            Assert.AreEqual(systemPerfInfo.TotalPages, 655360U);

            Assert.AreEqual(systemPerfInfo.GpuData.Adapters.Count, 1);
            GpuAdapter gpuAdapter = systemPerfInfo.GpuData.Adapters[0];

            Assert.AreEqual(gpuAdapter.DedicatedMemory, 268435456U);
            Assert.AreEqual(gpuAdapter.DedicatedMemoryUsed, 79282176U);
            Assert.AreEqual(gpuAdapter.Description, "ROOT\\SraKmd\\0000");
            Assert.AreEqual(gpuAdapter.SystemMemory, 1342177280U);
            Assert.AreEqual(gpuAdapter.SystemMemoryUsed, 10203136U);

            Assert.AreEqual(gpuAdapter.EnginesUtilization.Count, 7);
            double enguineUtilization = gpuAdapter.EnginesUtilization[0];

            Assert.AreEqual(enguineUtilization, 0.001146);

            NetworkPerformanceData networkPerformanceData = systemPerfInfo.NetworkData;

            Assert.AreEqual(networkPerformanceData.BytesIn, 15000U);
            Assert.AreEqual(networkPerformanceData.BytesOut, 0U);
        }
コード例 #2
0
        public void GetSystemPerfWebSocketTest_XboxOne_1608()
        {
            TestHelpers.MockHttpResponder.AddMockResponse(DevicePortal.SystemPerfApi, this.PlatformType, this.FriendlyOperatingSystemVersion, HttpMethods.WebSocket);

            ManualResetEvent             systemPerfReceived = new ManualResetEvent(false);
            SystemPerformanceInformation systemPerfInfo     = null;

            WindowsDevicePortal.WebSocketMessageReceivedEventHandler <SystemPerformanceInformation> systemPerfReceivedHandler = delegate(DevicePortal sender,
                                                                                                                                         WebSocketMessageReceivedEventArgs <SystemPerformanceInformation> args)
            {
                if (args.Message != null)
                {
                    systemPerfInfo = args.Message;
                    systemPerfReceived.Set();
                }
            };

            TestHelpers.Portal.SystemPerfMessageReceived += systemPerfReceivedHandler;

            Task startListeningForSystemPerfTask = TestHelpers.Portal.StartListeningForSystemPerfAsync();

            startListeningForSystemPerfTask.Wait();
            Assert.AreEqual(TaskStatus.RanToCompletion, startListeningForSystemPerfTask.Status);

            systemPerfReceived.WaitOne();

            Task stopListeningForSystemPerf = TestHelpers.Portal.StopListeningForSystemPerfAsync();

            stopListeningForSystemPerf.Wait();
            Assert.AreEqual(TaskStatus.RanToCompletion, stopListeningForSystemPerf.Status);

            TestHelpers.Portal.SystemPerfMessageReceived -= systemPerfReceivedHandler;

            ValidateSystemPerm(systemPerfInfo);
        }
コード例 #3
0
        /// <summary>
        /// Validate the <see cref="SystemPerformanceInformation" /> returned from the HoloLens tests.
        /// </summary>
        /// <param name="systemPerfInfo">The <see cref="SystemPerformanceInformation" /> to validate.</param>
        internal static void ValidateSystemPerfAsync(SystemPerformanceInformation systemPerfInfo)
        {
            // Check some known things about this response.
            Assert.AreEqual(275897, systemPerfInfo.AvailablePages);
            Assert.AreEqual(764290, systemPerfInfo.CommitLimit);
            Assert.AreEqual(225486, systemPerfInfo.CommittedPages);
            Assert.AreEqual(20, systemPerfInfo.CpuLoad);
            Assert.AreEqual(4337544, systemPerfInfo.IoOtherSpeed);
            Assert.AreEqual(1717438, systemPerfInfo.IoReadSpeed);
            Assert.AreEqual(788621, systemPerfInfo.IoWriteSpeed);
            Assert.AreEqual(15470, systemPerfInfo.NonPagedPoolPages);
            Assert.AreEqual(4096, systemPerfInfo.PageSize);
            Assert.AreEqual(18894, systemPerfInfo.PagedPoolPages);
            Assert.AreEqual(2097152, systemPerfInfo.TotalInstalledKb);
            Assert.AreEqual(502146, systemPerfInfo.TotalPages);

            Assert.AreEqual(systemPerfInfo.GpuData.Adapters.Count, 1);
            GpuAdapter gpuAdapter = systemPerfInfo.GpuData.Adapters[0];

            Assert.AreEqual((uint)119537664, gpuAdapter.DedicatedMemory);
            Assert.AreEqual((uint)65536, gpuAdapter.DedicatedMemoryUsed);
            Assert.AreEqual("HoloLens Graphics", gpuAdapter.Description);
            Assert.AreEqual((uint)1028395008, gpuAdapter.SystemMemory);
            Assert.AreEqual((uint)48513024, gpuAdapter.SystemMemoryUsed);

            Assert.AreEqual(9, gpuAdapter.EnginesUtilization.Count);
            Assert.AreEqual("7.098184", gpuAdapter.EnginesUtilization[0].ToString("n6"));

            NetworkPerformanceData networkPerformanceData = systemPerfInfo.NetworkData;

            Assert.AreEqual(0, networkPerformanceData.BytesIn);
            Assert.AreEqual(0, networkPerformanceData.BytesOut);
        }
コード例 #4
0
        /// <summary>
        /// Main entry point for handling a System Perf operation
        /// </summary>
        /// <param name="portal">DevicePortal reference for communicating with the device.</param>
        /// <param name="parameters">Parsed command line parameters.</param>
        public static void HandleOperation(DevicePortal portal, ParameterHelper parameters)
        {
            SystemPerformanceInformation systemPerformanceInformation = null;

            if (parameters.HasFlag(ParameterHelper.Listen))
            {
                ManualResetEvent systemPerfReceived = new ManualResetEvent(false);

                WebSocketMessageReceivedEventHandler <SystemPerformanceInformation> systemPerfReceivedHandler =
                    delegate(DevicePortal sender, WebSocketMessageReceivedEventArgs <SystemPerformanceInformation> sysPerfInfoArgs)
                {
                    if (sysPerfInfoArgs.Message != null)
                    {
                        systemPerformanceInformation = sysPerfInfoArgs.Message;
                        systemPerfReceived.Set();
                    }
                };

                portal.SystemPerfMessageReceived += systemPerfReceivedHandler;

                Task startListeningForSystemPerfTask = portal.StartListeningForSystemPerf();
                startListeningForSystemPerfTask.Wait();

                systemPerfReceived.WaitOne();

                Task stopListeningForSystemPerfTask = portal.StopListeningForRunningProcesses();
                stopListeningForSystemPerfTask.Wait();

                portal.SystemPerfMessageReceived -= systemPerfReceivedHandler;
            }
            else
            {
                Task <SystemPerformanceInformation> getRunningProcessesTask = portal.GetSystemPerf();
                systemPerformanceInformation = getRunningProcessesTask.Result;
            }

            Console.WriteLine("Available Pages: " + systemPerformanceInformation.AvailablePages);
            Console.WriteLine("Commit Limit: " + systemPerformanceInformation.CommitLimit);
            Console.WriteLine("Commited Pages: " + systemPerformanceInformation.CommittedPages);
            Console.WriteLine("CPU Load: " + systemPerformanceInformation.CpuLoad);
            Console.WriteLine("IoOther Speed: " + systemPerformanceInformation.IoOtherSpeed);
            Console.WriteLine("IoRead Speed: " + systemPerformanceInformation.IoReadSpeed);
            Console.WriteLine("IoWrite Speed: " + systemPerformanceInformation.IoWriteSpeed);
            Console.WriteLine("Non-paged Pool Pages: " + systemPerformanceInformation.NonPagedPoolPages);
            Console.WriteLine("Paged Pool Pages: " + systemPerformanceInformation.PagedPoolPages);
            Console.WriteLine("Page Size: " + systemPerformanceInformation.PageSize);
            Console.WriteLine("Total Installed Kb: " + systemPerformanceInformation.TotalInstalledKb);
            Console.WriteLine("Total Pages: " + systemPerformanceInformation.TotalPages);
        }
コード例 #5
0
        private void UpdateInfo()
        {
            SystemPerformanceInformation perfInfo = Program.ProcessProvider.Performance;
            int retLen;

            PerformanceInformation info;
            SystemCacheInformation cacheInfo;

            Win32.GetPerformanceInfo(out info, PerformanceInformation.SizeOf);
            Win32.NtQuerySystemInformation(SystemInformationClass.SystemFileCacheInformation, out cacheInfo, SystemCacheInformation.SizeOf, out retLen);

            string physMemText = Utils.FormatSize((_pages - perfInfo.AvailablePages) * _pageSize);

            string commitText = Utils.FormatSize(perfInfo.CommittedPages * _pageSize);

            switch (this.tabControl1.SelectedIndex)
            {
            case 0:
            {
                // Update the physical memory indicator here because we have perfInfo available.
                this.indicatorPhysical.Data1     = _pages - perfInfo.AvailablePages;
                this.indicatorPhysical.TextValue = physMemText;

                long memCount = (Program.ProcessProvider.System.NumberOfPhysicalPages - Program.ProcessProvider.Performance.AvailablePages) * Program.ProcessProvider.System.PageSize;

                this.trackerMemory.Text = "Phys. Mem: " + Utils.FormatSize(memCount) + " / " + Utils.FormatSize((long)info.PhysicalTotal * (long)info.PageSize);
                this.trackerCommit.Text =
                    "Commit: " +
                    Utils.FormatSize(Program.ProcessProvider.Performance.CommittedPages * Program.ProcessProvider.System.PageSize)
                    + " / " + Utils.FormatSize(Program.ProcessProvider.Performance.CommitLimit * Program.ProcessProvider.System.PageSize);
                this.indicatorCommit.Color1    = Settings.Instance.PlotterMemoryWSColor;
                this.indicatorCommit.TextValue = commitText;
                this.indicatorCommit.Maximum   = Program.ProcessProvider.Performance.CommitLimit * Program.ProcessProvider.System.PageSize;
                this.indicatorCommit.Data1     = Program.ProcessProvider.Performance.CommittedPages * Program.ProcessProvider.System.PageSize;
                break;
            }

            case 1:
            {
                // Totals
                this.labelTotalsProcesses.Text = info.ProcessCount.ToString("N0");
                this.labelTotalsThreads.Text   = info.ThreadCount.ToString("N0");
                this.labelTotalsHandles.Text   = info.HandlesCount.ToString("N0");
                this.labelTotalsUptime.Text    = Utils.FormatLongTimeSpan(Windows.GetUptime());

                // Commit
                this.labelCCC.Text = commitText;
                this.labelCCP.Text = Utils.FormatSize(perfInfo.PeakCommitment * _pageSize);
                this.labelCCL.Text = Utils.FormatSize(perfInfo.CommitLimit * _pageSize);

                // Physical Memory
                this.labelPMC.Text = physMemText;
                this.labelPSC.Text = Utils.FormatSize(info.SystemCache.ToInt32() * _pageSize);
                this.labelPMT.Text = Utils.FormatSize(_pages * _pageSize);

                // File cache
                this.labelCacheCurrent.Text = Utils.FormatSize(cacheInfo.SystemCacheWsSize);
                this.labelCachePeak.Text    = Utils.FormatSize(cacheInfo.SystemCacheWsPeakSize);
                this.labelCacheMinimum.Text = Utils.FormatSize(cacheInfo.SystemCacheWsMinimum.ToInt32() * _pageSize);
                this.labelCacheMaximum.Text = Utils.FormatSize(cacheInfo.SystemCacheWsMaximum.ToInt32() * _pageSize);

                // Paged/Non-paged pools
                this.labelKPPPU.Text = Utils.FormatSize(perfInfo.ResidentPagedPoolPage * _pageSize);
                this.labelKPPVU.Text = Utils.FormatSize(perfInfo.PagedPoolPages * _pageSize);
                this.labelKPPA.Text  = ((ulong)perfInfo.PagedPoolAllocs).ToString("N0");
                this.labelKPPF.Text  = ((ulong)perfInfo.PagedPoolFrees).ToString("N0");
                this.labelKPNPU.Text = Utils.FormatSize(perfInfo.NonPagedPoolPages * _pageSize);
                this.labelKPNPA.Text = ((ulong)perfInfo.NonPagedPoolAllocs).ToString("N0");
                this.labelKPNPF.Text = ((ulong)perfInfo.NonPagedPoolFrees).ToString("N0");

                // Get the pool limits
                // long pagedLimit = 0;
                // long nonPagedLimit = 0;

                //if (_mmSizeOfPagedPoolInBytes != IntPtr.Zero && _mmMaximumNonPagedPoolInBytes != IntPtr.Zero && KProcessHacker.Instance != null)
                //{
                //        int pl, npl;

                // this.GetPoolLimits(out pl, out npl);
                //        pagedLimit = pl;
                //        nonPagedLimit = npl;
                //}

                //if (pagedLimit != 0)
                //labelKPPL.Text = Utils.FormatSize(pagedLimit);
                //else
                this.labelKPPL.Text = "no symbols";

                // if (nonPagedLimit != 0)
                // labelKPNPL.Text = Utils.FormatSize(nonPagedLimit);
                // else
                this.labelKPNPL.Text = "no symbols";

                // Page faults
                this.labelPFTotal.Text      = ((ulong)perfInfo.PageFaultCount).ToString("N0");
                this.labelPFCOW.Text        = ((ulong)perfInfo.CopyOnWriteCount).ToString("N0");
                this.labelPFTrans.Text      = ((ulong)perfInfo.TransitionCount).ToString("N0");
                this.labelPFCacheTrans.Text = ((ulong)perfInfo.CacheTransitionCount).ToString("N0");
                this.labelPFDZ.Text         = ((ulong)perfInfo.CacheTransitionCount).ToString("N0");
                this.labelPFCache.Text      = ((ulong)cacheInfo.SystemCacheWsFaults).ToString("N0");

                // I/O
                this.labelIOR.Text  = ((ulong)perfInfo.IoReadOperationCount).ToString("N0");
                this.labelIORB.Text = Utils.FormatSize(perfInfo.IoReadTransferCount);
                this.labelIOW.Text  = ((ulong)perfInfo.IoWriteOperationCount).ToString("N0");
                this.labelIOWB.Text = Utils.FormatSize(perfInfo.IoWriteTransferCount);
                this.labelIOO.Text  = ((ulong)perfInfo.IoOtherOperationCount).ToString("N0");
                this.labelIOOB.Text = Utils.FormatSize(perfInfo.IoOtherTransferCount);

                // CPU
                this.labelCPUContextSwitches.Text = ((ulong)perfInfo.ContextSwitches).ToString("N0");
                this.labelCPUInterrupts.Text      = ((ulong)Program.ProcessProvider.ProcessorPerf.InterruptCount).ToString("N0");
                this.labelCPUSystemCalls.Text     = ((ulong)perfInfo.SystemCalls).ToString("N0");
                break;
            }
            }
        }