コード例 #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
 /// <summary>Create a new counter group</summary>
 /// <param name="name">of the group</param>
 /// <param name="displayName">of the group</param>
 /// <param name="limits">the counters limits policy object</param>
 /// <returns>a new counter group</returns>
 public virtual G NewGroup(string name, string displayName, Limits limits)
 {
     CounterGroupFactory.FrameworkGroupFactory <G> gf = fmap[name];
     if (gf != null)
     {
         return(gf.NewGroup(name));
     }
     if (name.Equals(FsGroupName))
     {
         return(NewFileSystemGroup());
     }
     else
     {
         if (s2i[name] != null)
         {
             return(NewFrameworkGroup(s2i[name]));
         }
     }
     return(NewGenericGroup(name, displayName, limits));
 }
コード例 #4
0
 public AbstractCounterGroup(string name, string displayName, Limits limits)
 {
     this.name        = name;
     this.displayName = displayName;
     this.limits      = limits;
 }
コード例 #5
0
 public virtual T FindCounter(string counterName, bool create)
 {
     return(FindCounterImpl(Limits.FilterCounterName(counterName), create));
 }
コード例 #6
0
 /// <summary>Create a new counter group</summary>
 /// <param name="name">of the group</param>
 /// <param name="limits">the counters limits policy object</param>
 /// <returns>a new counter group</returns>
 public virtual G NewGroup(string name, Limits limits)
 {
     return(NewGroup(name, ResourceBundles.GetCounterGroupName(name, name), limits));
 }
コード例 #7
0
 /// <summary>Abstract factory method to create a generic (vs framework) counter group
 ///     </summary>
 /// <param name="name">of the group</param>
 /// <param name="displayName">of the group</param>
 /// <param name="limits">limits of the counters</param>
 /// <returns>a new generic counter group</returns>
 protected internal abstract G NewGenericGroup(string name, string displayName, Limits
                                               limits);