public virtual void DoUpdates(MetricsContext unused)
 {
     lock (this)
     {
         shuffleMetrics.IncrMetric("shuffle_input_bytes", numBytes);
         shuffleMetrics.IncrMetric("shuffle_failed_fetches", numFailedFetches);
         shuffleMetrics.IncrMetric("shuffle_success_fetches", numSuccessFetches);
         if (numCopiers != 0)
         {
             shuffleMetrics.SetMetric("shuffle_fetchers_busy_percent", 100 * ((float)numThreadsBusy
                                                                              / numCopiers));
         }
         else
         {
             shuffleMetrics.SetMetric("shuffle_fetchers_busy_percent", 0);
         }
         numBytes          = 0;
         numSuccessFetches = 0;
         numFailedFetches  = 0;
     }
     shuffleMetrics.Update();
 }
 /// <summary>Push the delta  metrics to the mr.</summary>
 /// <remarks>
 /// Push the delta  metrics to the mr.
 /// The delta is since the last push/interval.
 /// Note this does NOT push to JMX
 /// (JMX gets the info via
 /// <see cref="previousIntervalValue"/>
 /// </remarks>
 /// <param name="mr"/>
 public override void PushMetric(MetricsRecord mr)
 {
     lock (this)
     {
         IntervalHeartBeat();
         try
         {
             mr.IncrMetric(GetName(), GetPreviousIntervalValue());
         }
         catch (Exception e)
         {
             Log.Info("pushMetric failed for " + GetName() + "\n", e);
         }
     }
 }
 /// <summary>Push the delta  metrics to the mr.</summary>
 /// <remarks>
 /// Push the delta  metrics to the mr.
 /// The delta is since the last push/interval.
 /// Note this does NOT push to JMX
 /// (JMX gets the info via
 /// <see cref="GetPreviousIntervalAverageTime()"/>
 /// and
 /// <see cref="GetPreviousIntervalNumOps()"/>
 /// </remarks>
 /// <param name="mr"/>
 public override void PushMetric(MetricsRecord mr)
 {
     lock (this)
     {
         IntervalHeartBeat();
         try
         {
             mr.IncrMetric(GetName() + "_num_ops", GetPreviousIntervalNumOps());
             mr.SetMetric(GetName() + "_avg_time", GetPreviousIntervalAverageTime());
         }
         catch (Exception e)
         {
             Log.Info("pushMetric failed for " + GetName() + "\n", e);
         }
     }
 }
示例#4
0
        private void DoGarbageCollectionUpdates()
        {
            IList <GarbageCollectorMXBean> gcBeans = ManagementFactory.GetGarbageCollectorMXBeans
                                                         ();
            long count      = 0;
            long timeMillis = 0;

            foreach (GarbageCollectorMXBean gcBean in gcBeans)
            {
                count      += gcBean.GetCollectionCount();
                timeMillis += gcBean.GetCollectionTime();
            }
            metrics.IncrMetric("gcCount", (int)(count - gcCount));
            metrics.IncrMetric("gcTimeMillis", (int)(timeMillis - gcTimeMillis));
            gcCount      = count;
            gcTimeMillis = timeMillis;
        }
 /// <summary>
 /// Since this object is a registered updater, this method will be called
 /// periodically, e.g.
 /// </summary>
 /// <remarks>
 /// Since this object is a registered updater, this method will be called
 /// periodically, e.g. every 5 seconds.
 /// </remarks>
 public virtual void DoUpdates(MetricsContext unused)
 {
     lock (this)
     {
         metricsRecord.IncrMetric("maps_launched", numMapTasksLaunched);
         metricsRecord.IncrMetric("maps_completed", numMapTasksCompleted);
         metricsRecord.IncrMetric("reduces_launched", numReduceTasksLaunched);
         metricsRecord.IncrMetric("reduces_completed", numReduceTasksCompleted);
         metricsRecord.IncrMetric("waiting_maps", numWaitingMaps);
         metricsRecord.IncrMetric("waiting_reduces", numWaitingReduces);
         numMapTasksLaunched     = 0;
         numMapTasksCompleted    = 0;
         numReduceTasksLaunched  = 0;
         numReduceTasksCompleted = 0;
         numWaitingMaps          = 0;
         numWaitingReduces       = 0;
     }
     metricsRecord.Update();
 }