VB.Net Tutorial/Development/PerformanceCounter

Материал из VB Эксперт
Версия от 12:53, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

System.Diagnostics.PerformanceCounter

public class Test
   public Shared Sub Main
        Dim PerformanceCounter2 As System.Diagnostics.PerformanceCounter
        PerformanceCounter2 = New System.Diagnostics.PerformanceCounter()
        Console.WriteLine("Category: " & PerformanceCounter2.CategoryName)
        Console.WriteLine("Counter: " & PerformanceCounter2.CounterName)
        Console.WriteLine("Instance: " & PerformanceCounter2.InstanceName)
        Console.WriteLine("Machine: " & Environment.MachineName)
        Console.WriteLine("RawValue: " & PerformanceCounter2.RawValue)
        
   End Sub
End class
Category:
Counter:
Instance:
Machine: vbex
Unhandled Exception: System.InvalidOperationException: Failed to initialize because CategoryName is
missing.
   at System.Diagnostics.PerformanceCounter.Initialize()
   at System.Diagnostics.PerformanceCounter.NextSample()
   at System.Diagnostics.PerformanceCounter.get_RawValue()
   at Test.Main()