Пример #1
0
        private void timer_Tick(object sender, EventArgs e)
        {
            PerformanceInfo           performanceInfo           = m_PerformanceCounterManager.GetCurrentInformation();
            NetworkingPerformanceInfo networkingPerformanceInfo = performanceInfo.NetworkingPerformanceInfo;

            lblBytesRecieved.Text          = networkingPerformanceInfo.BytesRecieved.ToString("N0", CultureInfo.InvariantCulture);
            lblBytesSent.Text              = networkingPerformanceInfo.BytesSent.ToString("N0", CultureInfo.InvariantCulture);
            lblConnectionsEstablished.Text = networkingPerformanceInfo.ConnectionsEstablised.ToString(CultureInfo.InvariantCulture);
            lblCpu.Text        = string.Format(CultureInfo.InvariantCulture, "%{0}", performanceInfo.CpuUsage);
            lblFreeMemory.Text = string.Format(CultureInfo.InvariantCulture, "{0:N0} / {1:N0} mb", performanceInfo.FreeMemory, performanceInfo.TotalMemory);
        }
Пример #2
0
        private void timerPerformanceInfo_Tick(object sender, EventArgs e)
        {
            PerformanceInfo currentInformation = m_PerformanceCounterManager.GetCurrentInformation();

            toolStripStatusAvailableMemory.Text = string.Format(CultureInfo.CurrentCulture, "{0:N0} / {1:N0} Mb Memory Available", currentInformation.FreeMemory, currentInformation.TotalMemory);

            int cpuUsage = currentInformation.CpuUsage;

            toolStripStatusCpu.Text = string.Format(CultureInfo.CurrentCulture, "CPU usage {0}%", cpuUsage);

            toolStripStatusCpu.Image = cpuImageList.Images[cpuUsage / 10];
        }