當前位置: 首頁>>代碼示例>>Java>>正文


Java DateUtils.MILLIS_PER_SECOND屬性代碼示例

本文整理匯總了Java中org.apache.commons.lang.time.DateUtils.MILLIS_PER_SECOND屬性的典型用法代碼示例。如果您正苦於以下問題:Java DateUtils.MILLIS_PER_SECOND屬性的具體用法?Java DateUtils.MILLIS_PER_SECOND怎麽用?Java DateUtils.MILLIS_PER_SECOND使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.apache.commons.lang.time.DateUtils的用法示例。


在下文中一共展示了DateUtils.MILLIS_PER_SECOND屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateAttemptMetrics

private static void updateAttemptMetrics(RMContainerImpl container) {
  // If this is a preempted container, update preemption metrics
  Resource resource = container.getContainer().getResource();
  RMAppAttempt rmAttempt = container.rmContext.getRMApps()
      .get(container.getApplicationAttemptId().getApplicationId())
      .getCurrentAppAttempt();
  if (ContainerExitStatus.PREEMPTED == container.finishedStatus
    .getExitStatus()) {
    rmAttempt.getRMAppAttemptMetrics().updatePreemptionInfo(resource,
      container);
  }

  if (rmAttempt != null) {
    long usedMillis = container.finishTime - container.creationTime;
    long memorySeconds = resource.getMemory()
                          * usedMillis / DateUtils.MILLIS_PER_SECOND;
    long vcoreSeconds = resource.getVirtualCores()
                         * usedMillis / DateUtils.MILLIS_PER_SECOND;
    long gcoreSeconds = resource.getGpuCores()
                         * usedMillis / DateUtils.MILLIS_PER_SECOND;
    rmAttempt.getRMAppAttemptMetrics()
              .updateAggregateAppResourceUsage(memorySeconds,vcoreSeconds, gcoreSeconds);
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:24,代碼來源:RMContainerImpl.java

示例2: getRunningAggregateAppResourceUsage

synchronized AggregateAppResourceUsage getRunningAggregateAppResourceUsage() {
  long currentTimeMillis = System.currentTimeMillis();
  // Don't walk the whole container list if the resources were computed
  // recently.
  if ((currentTimeMillis - lastMemoryAggregateAllocationUpdateTime)
      > MEM_AGGREGATE_ALLOCATION_CACHE_MSECS) {
    long memorySeconds = 0;
    long vcoreSeconds = 0;
    long gcoreSeconds = 0;
    for (RMContainer rmContainer : this.liveContainers.values()) {
      long usedMillis = currentTimeMillis - rmContainer.getCreationTime();
      Resource resource = rmContainer.getContainer().getResource();
      memorySeconds += resource.getMemory() * usedMillis /  
          DateUtils.MILLIS_PER_SECOND;
      vcoreSeconds += resource.getVirtualCores() * usedMillis  
          / DateUtils.MILLIS_PER_SECOND;
      gcoreSeconds += resource.getGpuCores() * usedMillis / DateUtils.MILLIS_PER_SECOND;
    }

    lastMemoryAggregateAllocationUpdateTime = currentTimeMillis;
    lastMemorySeconds = memorySeconds;
    lastVcoreSeconds = vcoreSeconds;
    lastGcoreSeconds = gcoreSeconds;
  }
  return new AggregateAppResourceUsage(lastMemorySeconds, lastVcoreSeconds, lastGcoreSeconds);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:26,代碼來源:SchedulerApplicationAttempt.java

示例3: updateAttemptMetrics

private static void updateAttemptMetrics(RMContainerImpl container) {
  // If this is a preempted container, update preemption metrics
  Resource resource = container.getContainer().getResource();
  RMAppAttempt rmAttempt = container.rmContext.getRMApps()
      .get(container.getApplicationAttemptId().getApplicationId())
      .getCurrentAppAttempt();

  if (rmAttempt != null) {
    if (ContainerExitStatus.PREEMPTED == container.finishedStatus
        .getExitStatus()) {
        rmAttempt.getRMAppAttemptMetrics().updatePreemptionInfo(resource,
          container);
      }
    
    long usedMillis = container.finishTime - container.creationTime;
    long memorySeconds = resource.getMemory()
                          * usedMillis / DateUtils.MILLIS_PER_SECOND;
    long vcoreSeconds = resource.getVirtualCores()
                         * usedMillis / DateUtils.MILLIS_PER_SECOND;
    rmAttempt.getRMAppAttemptMetrics()
              .updateAggregateAppResourceUsage(memorySeconds,vcoreSeconds);
  }
}
 
開發者ID:aliyun-beta,項目名稱:aliyun-oss-hadoop-fs,代碼行數:23,代碼來源:RMContainerImpl.java

示例4: getRunningAggregateAppResourceUsage

synchronized AggregateAppResourceUsage getRunningAggregateAppResourceUsage() {
  long currentTimeMillis = System.currentTimeMillis();
  // Don't walk the whole container list if the resources were computed
  // recently.
  if ((currentTimeMillis - lastMemoryAggregateAllocationUpdateTime)
      > MEM_AGGREGATE_ALLOCATION_CACHE_MSECS) {
    long memorySeconds = 0;
    long vcoreSeconds = 0;
    for (RMContainer rmContainer : this.liveContainers.values()) {
      long usedMillis = currentTimeMillis - rmContainer.getCreationTime();
      Resource resource = rmContainer.getContainer().getResource();
      memorySeconds += resource.getMemory() * usedMillis /  
          DateUtils.MILLIS_PER_SECOND;
      vcoreSeconds += resource.getVirtualCores() * usedMillis  
          / DateUtils.MILLIS_PER_SECOND;
    }

    lastMemoryAggregateAllocationUpdateTime = currentTimeMillis;
    lastMemorySeconds = memorySeconds;
    lastVcoreSeconds = vcoreSeconds;
  }
  return new AggregateAppResourceUsage(lastMemorySeconds, lastVcoreSeconds);
}
 
開發者ID:aliyun-beta,項目名稱:aliyun-oss-hadoop-fs,代碼行數:23,代碼來源:SchedulerApplicationAttempt.java

示例5: getValueIn

public float getValueIn(final Field field) {
    final Calendar cal = Calendar.getInstance();
    cal.setTimeInMillis(0L);
    final Calendar cal2 = add(cal);
    final float millisDiff = cal2.getTimeInMillis() - cal.getTimeInMillis();
    switch (field) {
        case MILLIS:
            return millisDiff;
        case SECONDS:
            return millisDiff / DateUtils.MILLIS_PER_SECOND;
        case MINUTES:
            return millisDiff / DateUtils.MILLIS_PER_MINUTE;
        case HOURS:
            return millisDiff / DateUtils.MILLIS_PER_HOUR;
        case DAYS:
            return millisDiff / DateUtils.MILLIS_PER_DAY;
        case WEEKS:
            return millisDiff / (DateUtils.MILLIS_PER_DAY * 7);
        case MONTHS:
            return millisDiff / (DateUtils.MILLIS_PER_DAY * 30);
        case YEARS:
            return millisDiff / (DateUtils.MILLIS_PER_DAY * 365);
    }
    return 0F;
}
 
開發者ID:mateli,項目名稱:OpenCyclos,代碼行數:25,代碼來源:TimePeriod.java

示例6: calculateContainerResourceMetrics

private AggregateAppResourceUsage calculateContainerResourceMetrics(
    RMContainer rmContainer) {
  Resource resource = rmContainer.getContainer().getResource();
  long usedMillis =
      rmContainer.getFinishTime() - rmContainer.getCreationTime();
  long memorySeconds = resource.getMemory()
                        * usedMillis / DateUtils.MILLIS_PER_SECOND;
  long vcoreSeconds = resource.getVirtualCores()
                        * usedMillis / DateUtils.MILLIS_PER_SECOND;
  long gcoreSeconds = resource.getGpuCores()
                        * usedMillis / DateUtils.MILLIS_PER_SECOND;
  return new AggregateAppResourceUsage(memorySeconds, vcoreSeconds, gcoreSeconds);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:13,代碼來源:TestContainerResourceUsage.java

示例7: calculateContainerResourceMetrics

private AggregateAppResourceUsage calculateContainerResourceMetrics(
    RMContainer rmContainer) {
  Resource resource = rmContainer.getContainer().getResource();
  long usedMillis =
      rmContainer.getFinishTime() - rmContainer.getCreationTime();
  long memorySeconds = resource.getMemory()
                        * usedMillis / DateUtils.MILLIS_PER_SECOND;
  long vcoreSeconds = resource.getVirtualCores()
                        * usedMillis / DateUtils.MILLIS_PER_SECOND;
  return new AggregateAppResourceUsage(memorySeconds, vcoreSeconds);
}
 
開發者ID:aliyun-beta,項目名稱:aliyun-oss-hadoop-fs,代碼行數:11,代碼來源:TestContainerResourceUsage.java

示例8: updateAttemptMetrics

private static void updateAttemptMetrics(RMContainerImpl container) {
  // If this is a preempted container, update preemption metrics
  Resource resource = container.getContainer().getResource();
  RMAppAttempt rmAttempt = container.rmContext.getRMApps()
      .get(container.getApplicationAttemptId().getApplicationId())
      .getCurrentAppAttempt();
  if (ContainerExitStatus.PREEMPTED == container.finishedStatus
    .getExitStatus()) {
    rmAttempt.getRMAppAttemptMetrics().updatePreemptionInfo(resource,
      container);
  }
  
  if (rmAttempt != null) {
    long usedMillis = container.finishTime - container.creationTime;
    long memorySeconds = (long)(resource.getMemory()*container.utilization)
                          * usedMillis / DateUtils.MILLIS_PER_SECOND;
    long vcoreSeconds = (long)(resource.getVirtualCores()*container.utilization)
                         * usedMillis / DateUtils.MILLIS_PER_SECOND;
    
    if (container.suspendTime.size() >0 && container.resumeTime.size() >0 && container.suspendTime.size() == container.resumeTime.size()){
    	double acc=0;
    	for(int i=0; i < container.suspendTime.size();i++){
    		
    		acc = acc + (container.resumeTime.get(i) - container.suspendTime.get(i));
    	}
    	container.utilization = acc/usedMillis;  	
    }
    rmAttempt.getRMAppAttemptMetrics()
              .updateAggregateAppResourceUsage(memorySeconds,vcoreSeconds);
  }
}
 
開發者ID:yncxcw,項目名稱:big-c,代碼行數:31,代碼來源:RMContainerImpl.java


注:本文中的org.apache.commons.lang.time.DateUtils.MILLIS_PER_SECOND屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。