@Test public void testSetAvgMetrics() { taskMonitor.setAvgMetrics(TaskMonitor.AVG_GPU_FB_MEMORY_USAGE_INDEX, 0.1); taskMonitor.numRefreshes++; taskMonitor.setAvgMetrics(TaskMonitor.AVG_GPU_FB_MEMORY_USAGE_INDEX, 0.3); taskMonitor.numRefreshes++; taskMonitor.setAvgMetrics(TaskMonitor.AVG_GPU_FB_MEMORY_USAGE_INDEX, 0.5); MetricsWritable metrics = taskMonitor.getMetrics(); Assert.assertEquals(metrics.getMetric(TaskMonitor.AVG_GPU_FB_MEMORY_USAGE_INDEX).getValue(), 0.3); }
@VisibleForTesting void setAvgMetrics(int metricIndex, double newMetricValue) { MetricWritable metric = metrics.getMetric(metricIndex); metric.setValue((metric.getValue() * numRefreshes + newMetricValue) / (numRefreshes + 1)); metrics.setMetric(metricIndex, metric); }
TaskMonitor implements Runnable { @VisibleForTesting void setAvgMetrics(int metricIndex, double newMetricValue) { MetricWritable metric = metrics.getMetric(metricIndex); metric.setValue((metric.getValue() * numRefreshes + newMetricValue) / (numRefreshes + 1)); metrics.setMetric(metricIndex, metric); } }
TaskMonitor implements Runnable { @VisibleForTesting void setAvgMetrics(int metricIndex, double newMetricValue) { MetricWritable metric = metrics.getMetric(metricIndex); metric.setValue((metric.getValue() * numRefreshes + newMetricValue) / (numRefreshes + 1)); metrics.setMetric(metricIndex, metric); } TaskMonitor(String taskType, int taskIndex,
      Configuration yarnConf, Configuration tonyConf, MetricsRpc metricsRpcClient); }
TaskMonitor implements Runnable { @VisibleForTesting void setAvgMetrics(int metricIndex, double newMetricValue) { MetricWritable metric = metrics.getMetric(metricIndex); metric.setValue((metric.getValue() * numRefreshes + newMetricValue) / (numRefreshes + 1)); metrics.setMetric(metricIndex, metric); } TaskMonitor(String taskType, int taskIndex,
      Configuration yarnConf, Configuration tonyConf, MetricsRpc metricsRpcClient); @Override void run(); }
TaskMonitor implements Runnable { @VisibleForTesting void setAvgMetrics(int metricIndex, double newMetricValue) { MetricWritable metric = metrics.getMetric(metricIndex); metric.setValue((metric.getValue() * numRefreshes + newMetricValue) / (numRefreshes + 1)); metrics.setMetric(metricIndex, metric); } TaskMonitor(String taskType, int taskIndex,
      Configuration yarnConf, Configuration tonyConf, MetricsRpc metricsRpcClient); @Override void run(); static final List<String> METRICS_TO_COLLECT; static final int MAX_MEMORY_BYTES_INDEX; static final int AVG_MEMORY_BYTES_INDEX; static final int MAX_GPU_UTILIZATION_INDEX; static final int AVG_GPU_UTILIZATION_INDEX; static final int MAX_GPU_FB_MEMORY_USAGE_INDEX; static final int AVG_GPU_FB_MEMORY_USAGE_INDEX; static final int MAX_GPU_MAIN_MEMORY_USAGE_INDEX; static final int AVG_GPU_MAIN_MEMORY_USAGE_INDEX; }