Beispiel #1
0
 public void initialize(DragonConfiguration conf, JobId id)
     throws IOException, ClassNotFoundException, InterruptedException {
   Class<? extends ResourceCalculatorPlugin> clazz =
       conf.getClass(
           DragonConfig.RESOURCE_CALCULATOR_PLUGIN, null, ResourceCalculatorPlugin.class);
   resourceCalculator = ResourceCalculatorPlugin.getResourceCalculatorPlugin(clazz, conf);
   LOG.info(" Using ResourceCalculatorPlugin : " + resourceCalculator);
   if (resourceCalculator != null) {
     initCpuCumulativeTime = resourceCalculator.getProcResourceValues().getCumulativeCpuTime();
   }
 }
Beispiel #2
0
  /** Update resource information counters */
  void updateResourceCounters() {
    // Update generic resource counters
    updateHeapUsageCounter();

    // Updating resources specified in ResourceCalculatorPlugin
    if (resourceCalculator == null) {
      return;
    }
    ProcResourceValues res = resourceCalculator.getProcResourceValues();
    long cpuTime = res.getCumulativeCpuTime();
    long pMem = res.getPhysicalMemorySize();
    long vMem = res.getVirtualMemorySize();
    // Remove the CPU time consumed previously by JVM reuse
    cpuTime -= initCpuCumulativeTime;
    counters.getCounter(TaskCounter.CPU_MILLISECONDS).setValue(cpuTime);
    counters.getCounter(TaskCounter.PHYSICAL_MEMORY_BYTES).setValue(pMem);
    counters.getCounter(TaskCounter.VIRTUAL_MEMORY_BYTES).setValue(vMem);
  }