Esempio n. 1
0
 internal virtual void AddTimeStat(string name, StatisticsCollector.Stat.TimeStat
                                   s)
 {
     lock (this)
     {
         statToCollect[name] = s;
     }
 }
Esempio n. 2
0
 internal virtual StatisticsCollector.Stat CreateStat(string name, StatisticsCollector.TimeWindow
                                                      [] windows)
 {
     lock (this)
     {
         if (statistics[name] != null)
         {
             throw new RuntimeException("Stat with name " + name + " is already defined");
         }
         IDictionary <StatisticsCollector.TimeWindow, StatisticsCollector.Stat.TimeStat> timeStats
             = new LinkedHashMap <StatisticsCollector.TimeWindow, StatisticsCollector.Stat.TimeStat
                                  >();
         foreach (StatisticsCollector.TimeWindow window in windows)
         {
             StatisticsCollector.StatUpdater collector = updaters[window];
             if (collector == null)
             {
                 if (SinceStart.Equals(window))
                 {
                     collector = new StatisticsCollector.StatUpdater();
                 }
                 else
                 {
                     collector = new StatisticsCollector.TimeWindowStatUpdater(window, period);
                 }
                 updaters[window] = collector;
             }
             StatisticsCollector.Stat.TimeStat timeStat = new StatisticsCollector.Stat.TimeStat
                                                              ();
             collector.AddTimeStat(name, timeStat);
             timeStats[window] = timeStat;
         }
         StatisticsCollector.Stat stat = new StatisticsCollector.Stat(name, timeStats);
         statistics[name] = stat;
         return(stat);
     }
 }