当前位置: 首页>>代码示例>>Java>>正文


Java MetricsTimeVaryingInt类代码示例

本文整理汇总了Java中org.apache.hadoop.metrics.util.MetricsTimeVaryingInt的典型用法代码示例。如果您正苦于以下问题:Java MetricsTimeVaryingInt类的具体用法?Java MetricsTimeVaryingInt怎么用?Java MetricsTimeVaryingInt使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MetricsTimeVaryingInt类属于org.apache.hadoop.metrics.util包,在下文中一共展示了MetricsTimeVaryingInt类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ClusterManagerMetrics

import org.apache.hadoop.metrics.util.MetricsTimeVaryingInt; //导入依赖的package包/类
/**
 * Constructor.
 * @param types The available resource types.
 */
public ClusterManagerMetrics(Collection<ResourceType> types) {
  context = MetricsUtil.getContext(CONTEXT_NAME);
  metricsRecord = MetricsUtil.createRecord(context, CONTEXT_NAME);
  typeToResourceRequested = createTypeToResourceCountMap(types, "requested");
  typeToResourceGranted = createTypeToResourceCountMap(types, "granted");
  typeToResourceRevoked = createTypeToResourceCountMap(types, "revoked");
  typeToResourceReleased = createTypeToResourceCountMap(types, "released");
  typeToPendingCount = createTypeToCountMap(types, "pending");
  typeToRunningCount = createTypeToCountMap(types, "running");
  typeToTotalSlots = createTypeToCountMap(types, "total");
  typeToFreeSlots = createTypeToCountMap(types, "free");
  typeToSchedulerRunTime = createTypeToCountMap(types, "scheduler_runtime");
  typeToSchedulerCurrentCycleStart =
      new ConcurrentHashMap<ResourceType, Long>();
  sessionStatusToMetrics = createSessionStatusToMetricsMap();
  aliveNodes = new MetricsIntValue("alive_nodes", registry);
  deadNodes = new MetricsIntValue("dead_nodes", registry);
  blacklistedNodes = new MetricsIntValue("blacklisted_nodes", registry);
  numRunningSessions = new MetricsIntValue("num_running_sessions", registry);
  totalSessionCount = new MetricsTimeVaryingInt("total_sessions", registry);
  pendingCallsCount = new MetricsIntValue("num_pending_calls", registry);
  numCJTFailures = new MetricsTimeVaryingInt("num_cjt_failures", registry);
  numTaskTrackerRestarted = new MetricsIntValue("num_task_tracker_restarted", registry);
  numRemoteJTTimedout = new MetricsIntValue("num_remotejt_timedout", registry);
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:30,代码来源:ClusterManagerMetrics.java

示例2: ClusterManagerMetrics

import org.apache.hadoop.metrics.util.MetricsTimeVaryingInt; //导入依赖的package包/类
/**
 * Constructor.
 * @param types The available resource types.
 */
public ClusterManagerMetrics(Collection<ResourceType> types) {
  context = MetricsUtil.getContext(CONTEXT_NAME);
  metricsRecord = MetricsUtil.createRecord(context, CONTEXT_NAME);
  typeToResourceRequested = createTypeToResourceCountMap(types, "requested");
  typeToResourceGranted = createTypeToResourceCountMap(types, "granted");
  typeToResourceRevoked = createTypeToResourceCountMap(types, "revoked");
  typeToResourceReleased = createTypeToResourceCountMap(types, "released");
  typeToPendingCount = createTypeToCountMap(types, "pending");
  typeToRunningCount = createTypeToCountMap(types, "running");
  typeToTotalSlots = createTypeToCountMap(types, "total");
  typeToFreeSlots = createTypeToCountMap(types, "free");
  typeToSchedulerRunTime = createTypeToCountMap(types, "scheduler_runtime");
  sessionStatusToMetrics = createSessionStatusToMetricsMap();
  aliveNodes = new MetricsIntValue("alive_nodes", registry);
  deadNodes = new MetricsIntValue("dead_nodes", registry);
  blacklistedNodes = new MetricsIntValue("blacklisted_nodes", registry);
  numRunningSessions = new MetricsIntValue("num_running_sessions", registry);
  totalSessionCount = new MetricsTimeVaryingInt("total_sessions", registry);
  pendingCallsCount = new MetricsIntValue("num_pending_calls", registry);
  numCJTFailures = new MetricsTimeVaryingInt("num_cjt_failures", registry);
}
 
开发者ID:iVCE,项目名称:RDFS,代码行数:26,代码来源:ClusterManagerMetrics.java

示例3: createSessionStatusToMetricsMap

import org.apache.hadoop.metrics.util.MetricsTimeVaryingInt; //导入依赖的package包/类
/**
 * Create a map of session status -> metrics.
 * @return the map.
 */
private Map<SessionStatus, MetricsTimeVaryingInt>
createSessionStatusToMetricsMap() {
  Map<SessionStatus, MetricsTimeVaryingInt> m =
    new HashMap<SessionStatus, MetricsTimeVaryingInt>();
  for (SessionStatus endState : SESSION_END_STATES) {
    String name = endState.toString().toLowerCase() + "_sessions";
    m.put(endState, new MetricsTimeVaryingInt(name, registry));
  }
  return m;
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:15,代码来源:ClusterManagerMetrics.java

示例4: updateCounter

import org.apache.hadoop.metrics.util.MetricsTimeVaryingInt; //导入依赖的package包/类
private void updateCounter(MetricsTimeVaryingInt localCounter,
    MetricsTimeVaryingInt remoteCounter) {
  (isLocal? localCounter: remoteCounter).inc();
}
 
开发者ID:cumulusyebl,项目名称:cumulus,代码行数:5,代码来源:DataXceiver.java

示例5: testSyncBatching

import org.apache.hadoop.metrics.util.MetricsTimeVaryingInt; //导入依赖的package包/类
public void testSyncBatching() throws Exception {
  // start a cluster 
  Configuration conf = new HdfsConfiguration();
  MiniDFSCluster cluster = null;
  FileSystem fileSys = null;
  ExecutorService threadA = Executors.newSingleThreadExecutor();
  ExecutorService threadB = Executors.newSingleThreadExecutor();
  try {
    cluster = new MiniDFSCluster.Builder(conf).numDataNodes(NUM_DATA_NODES).build();
    cluster.waitActive();
    fileSys = cluster.getFileSystem();
    final FSNamesystem namesystem = cluster.getNamesystem();

    FSImage fsimage = namesystem.getFSImage();
    final FSEditLog editLog = fsimage.getEditLog();

    assertEquals("should start with no txids synced",
      0, editLog.getSyncTxId());
    
    // Log an edit from thread A
    doLogEdit(threadA, editLog, "thread-a 1");
    assertEquals("logging edit without syncing should do not affect txid",
      0, editLog.getSyncTxId());

    // Log an edit from thread B
    doLogEdit(threadB, editLog, "thread-b 1");
    assertEquals("logging edit without syncing should do not affect txid",
      0, editLog.getSyncTxId());

    // Now ask to sync edit from B, which should sync both edits.
    doCallLogSync(threadB, editLog);
    assertEquals("logSync from second thread should bump txid up to 2",
      2, editLog.getSyncTxId());

    // Now ask to sync edit from A, which was already batched in - thus
    // it should increment the batch count metric
    NameNodeMetrics metrics = NameNode.getNameNodeMetrics();
    metrics.transactionsBatchedInSync = Mockito.mock(MetricsTimeVaryingInt.class);

    doCallLogSync(threadA, editLog);
    assertEquals("logSync from first thread shouldn't change txid",
      2, editLog.getSyncTxId());

    //Should have incremented the batch count exactly once
    Mockito.verify(metrics.transactionsBatchedInSync,
                  Mockito.times(1)).inc();
  } finally {
    threadA.shutdown();
    threadB.shutdown();
    if(fileSys != null) fileSys.close();
    if(cluster != null) cluster.shutdown();
  }
}
 
开发者ID:cumulusyebl,项目名称:cumulus,代码行数:54,代码来源:TestEditLog.java


注:本文中的org.apache.hadoop.metrics.util.MetricsTimeVaryingInt类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。