Esempio n. 1
0
        static PerformanceHandler()
        {
            //初始化计数器
            List <CounterConfig> pCounterInfos = new List <CounterConfig>
            {
                new CounterConfig("Network Interface", "Bytes Received/sec", CustomType.Download, NetFunc),
                new CounterConfig("Network Interface", "Bytes Sent/sec", CustomType.Upload, NetFunc),
            };

            PCounters = new PerformanceCounters(pCounterInfos, 1000);
        }
Esempio n. 2
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (listBox1.SelectedItem == null)
     {
         MessageBox.Show("先把第一个选上");
     }
     else
     {
         var datas = PerformanceCounters.GetAllInstanceWithCategory(listBox1.SelectedItem.ToString());
         datas?.ForEach(t => listBox3.Items.Add(t));
     }
 }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            var datas = PerformanceCounters.GetAllCategorys();

            datas?.ForEach(t => listBox1.Items.Add(t));
        }
        static void Main(string[] args)
        {
            PerformanceCounters.EnsureCreated();

            Start().GetAwaiter().GetResult();
        }