コード例 #1
0
 public virtual T AddCounter(string counterName, string displayName, long value)
 {
     lock (this)
     {
         string saveName = Limits.FilterCounterName(counterName);
         T      counter  = FindCounterImpl(saveName, false);
         if (counter == null)
         {
             return(AddCounterImpl(saveName, displayName, value));
         }
         counter.SetValue(value);
         return(counter);
     }
 }
コード例 #2
0
 public virtual T FindCounter(string counterName, string displayName)
 {
     lock (this)
     {
         // Take lock to avoid two threads not finding a counter and trying to add
         // the same counter.
         string saveName = Limits.FilterCounterName(counterName);
         T      counter  = FindCounterImpl(saveName, false);
         if (counter == null)
         {
             return(AddCounterImpl(saveName, displayName, 0));
         }
         return(counter);
     }
 }
コード例 #3
0
 public virtual T FindCounter(string counterName, bool create)
 {
     return(FindCounterImpl(Limits.FilterCounterName(counterName), create));
 }