public PerformanceCounterCategoryMetadata()
 {
     CacheRequests = new PerformanceCounterMetadata()
     {
         Name = "Cache Requests",
         Description = "Total requests made to cache",
         Type = PerformanceCounterType.NumberOfItems64,
         Category = this
     };
     CacheHits = new PerformanceCounterMetadata()
     {
         Name = "Cache Hits",
         Description = "Total cache hits",
         Type = PerformanceCounterType.NumberOfItems64,
         Category = this
     };
     CacheMisses = new PerformanceCounterMetadata()
     {
         Name = "Cache Misses",
         Description = "Total cache misses",
         Type = PerformanceCounterType.NumberOfItems64,
         Category = this
     };
     Counters = new List<PerformanceCounterMetadata>() { CacheRequests, CacheHits, CacheMisses };
 }
Пример #2
0
 public PerformanceCounterCategoryMetadata()
 {
     CacheRequests = new PerformanceCounterMetadata()
     {
         Name        = "Cache Requests",
         Description = "Total requests made to cache",
         Type        = PerformanceCounterType.NumberOfItems64,
         Category    = this
     };
     CacheHits = new PerformanceCounterMetadata()
     {
         Name        = "Cache Hits",
         Description = "Total cache hits",
         Type        = PerformanceCounterType.NumberOfItems64,
         Category    = this
     };
     CacheMisses = new PerformanceCounterMetadata()
     {
         Name        = "Cache Misses",
         Description = "Total cache misses",
         Type        = PerformanceCounterType.NumberOfItems64,
         Category    = this
     };
     Counters = new List <PerformanceCounterMetadata>()
     {
         CacheRequests, CacheHits, CacheMisses
     };
 }
 /// <summary>
 /// Increment the count of a "number of itesm" performance counter
 /// </summary>
 /// <param name="counter"></param>
 public static void IncrementCount(PerformanceCounterMetadata counter)
 {
     EnsureCounter(counter);
     if (counter.Type == PerformanceCounterType.NumberOfItems64)
     {
         if (_Counters.ContainsKey(counter.FullName))
         {
             try
             {
                 _Counters[counter.FullName].Increment();
             }
             catch (Exception ex)
             {
                 Log.Debug("Instrumentation.IncrementCounter failed for: {0}. Error: {1}", counter.FullName, ex.FullMessage());
             }
         }
     }
 }
 private static void EnsureCounter(PerformanceCounterMetadata counter)
 {
     if (!_Counters.ContainsKey(counter.FullName))
     {
         try
         {
             if (!PerformanceCounterCategory.Exists(counter.Category.Name))
             {
                 CreateCounters(counter.Category);
             }
             _Counters[counter.FullName] = new diag.PerformanceCounter(counter.Category.Name, counter.Name, false);
         }
         catch (Exception ex)
         {
             Log.Warn("Instrumentation.EnsureCounters failed to initialise performance counter: {0}. Counter may not be initialised. Error: {1}", counter.Name, ex.FullMessage());
         }
     }
 }
Пример #5
0
 /// <summary>
 /// Increment the count of a "number of itesm" performance counter
 /// </summary>
 /// <param name="counter"></param>
 public static void IncrementCount(PerformanceCounterMetadata counter)
 {
     EnsureCounter(counter);
     if (counter.Type == PerformanceCounterType.NumberOfItems64)
     {
         if (_Counters.ContainsKey(counter.FullName))
         {
             try
             {
                 _Counters[counter.FullName].Increment();
             }
             catch (Exception ex)
             {
                 Log.Debug("Instrumentation.IncrementCounter failed for: {0}. Error: {1}", counter.FullName, ex.FullMessage());
             }
         }
     }
 }
Пример #6
0
 private static void EnsureCounter(PerformanceCounterMetadata counter)
 {
     if (!_Counters.ContainsKey(counter.FullName))
     {
         try
         {
             if (!PerformanceCounterCategory.Exists(counter.Category.Name))
             {
                 CreateCounters(counter.Category);
             }
             _Counters[counter.FullName] = new diag.PerformanceCounter(counter.Category.Name, counter.Name, false);
         }
         catch (Exception ex)
         {
             Log.Warn("Instrumentation.EnsureCounters failed to initialise performance counter: {0}. Counter may not be initialised. Error: {1}", counter.Name, ex.FullMessage());
         }
     }
 }