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


Java Metrics.newTimer方法代碼示例

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


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

示例1: CommitLogMetrics

import com.yammer.metrics.Metrics; //導入方法依賴的package包/類
public CommitLogMetrics(final AbstractCommitLogService service, final CommitLogSegmentManager allocator)
{
    completedTasks = Metrics.newGauge(factory.createMetricName("CompletedTasks"), new Gauge<Long>()
    {
        public Long value()
        {
            return service.getCompletedTasks();
        }
    });
    pendingTasks = Metrics.newGauge(factory.createMetricName("PendingTasks"), new Gauge<Long>()
    {
        public Long value()
        {
            return service.getPendingTasks();
        }
    });
    totalCommitLogSize = Metrics.newGauge(factory.createMetricName("TotalCommitLogSize"), new Gauge<Long>()
    {
        public Long value()
        {
            return allocator.bytesUsed();
        }
    });
    waitingOnSegmentAllocation = Metrics.newTimer(factory.createMetricName("WaitingOnSegmentAllocation"), TimeUnit.MICROSECONDS, TimeUnit.SECONDS);
    waitingOnCommit = Metrics.newTimer(factory.createMetricName("WaitingOnCommit"), TimeUnit.MICROSECONDS, TimeUnit.SECONDS);
}
 
開發者ID:vcostet,項目名稱:cassandra-kmean,代碼行數:27,代碼來源:CommitLogMetrics.java

示例2: init

import com.yammer.metrics.Metrics; //導入方法依賴的package包/類
@Override
public void init(Configuration queryExecutorConfig, DataManager dataManager, ServerMetrics serverMetrics)
    throws ConfigurationException {
  _serverMetrics = serverMetrics;
  _queryExecutorConfig = new QueryExecutorConfig(queryExecutorConfig);
  _instanceDataManager = (InstanceDataManager) dataManager;
  if (_queryExecutorConfig.getTimeOut() > 0) {
    _defaultTimeOutMs = _queryExecutorConfig.getTimeOut();
  }
  LOGGER.info("Default timeout for query executor : {}", _defaultTimeOutMs);
  LOGGER.info("Trying to build SegmentPrunerService");
  if (_segmentPrunerService == null) {
    _segmentPrunerService = new SegmentPrunerServiceImpl(_queryExecutorConfig.getPrunerConfig());
  }
  LOGGER.info("Trying to build QueryPlanMaker");
  _planMaker = new InstancePlanMakerImplV2();
  LOGGER.info("Trying to build QueryExecutorTimer");
  if (_queryExecutorTimer == null) {
    _queryExecutorTimer =
        Metrics.newTimer(new MetricName(Domain, "timer", "query-executor-time-"), TimeUnit.MILLISECONDS,
            TimeUnit.SECONDS);
  }
}
 
開發者ID:Hanmourang,項目名稱:Pinot,代碼行數:24,代碼來源:ServerQueryExecutorV1Impl.java

示例3: LatencyMetrics

import com.yammer.metrics.Metrics; //導入方法依賴的package包/類
/**
 * Create LatencyMetrics with given group, type, prefix to append to each metric name, and scope.
 *
 * @param factory MetricName factory to use
 * @param namePrefix Prefix to append to each metric name
 */
public LatencyMetrics(MetricNameFactory factory, String namePrefix)
{
    this.factory = factory;
    this.namePrefix = namePrefix;

    latency = Metrics.newTimer(factory.createMetricName(namePrefix + "Latency"), TimeUnit.MICROSECONDS, TimeUnit.SECONDS);
    totalLatency = Metrics.newCounter(factory.createMetricName(namePrefix + "TotalLatency"));
}
 
開發者ID:vcostet,項目名稱:cassandra-kmean,代碼行數:15,代碼來源:LatencyMetrics.java

示例4: IndexManager

import com.yammer.metrics.Metrics; //導入方法依賴的package包/類
public IndexManager(IndexServer indexServer, ClusterStatus clusterStatus, BlurFilterCache filterCache,
    int maxHeapPerRowFetch, int fetchCount, int threadCount, int mutateThreadCount, int facetThreadCount,
    DeepPagingCache deepPagingCache, MemoryAllocationWatcher memoryAllocationWatcher, QueryStatusManager statusManager) {
  _statusManager = statusManager;
  _memoryAllocationWatcher = memoryAllocationWatcher;
  _deepPagingCache = deepPagingCache;
  _indexServer = indexServer;
  _clusterStatus = clusterStatus;
  _filterCache = filterCache;

  MetricName metricName1 = new MetricName(ORG_APACHE_BLUR, BLUR, "External Queries/s");
  MetricName metricName2 = new MetricName(ORG_APACHE_BLUR, BLUR, "Internal Queries/s");
  MetricName metricName3 = new MetricName(ORG_APACHE_BLUR, BLUR, "Fetch Timer");

  _queriesExternalMeter = Metrics.newMeter(metricName1, "External Queries/s", TimeUnit.SECONDS);
  _queriesInternalMeter = Metrics.newMeter(metricName2, "Internal Queries/s", TimeUnit.SECONDS);
  _fetchTimer = Metrics.newTimer(metricName3, TimeUnit.MICROSECONDS, TimeUnit.SECONDS);

  if (threadCount == 0) {
    throw new RuntimeException("Thread Count cannot be 0.");
  }
  _threadCount = threadCount;
  if (mutateThreadCount == 0) {
    throw new RuntimeException("Mutate Thread Count cannot be 0.");
  }
  _mutateThreadCount = mutateThreadCount;
  _fetchCount = fetchCount;
  _maxHeapPerRowFetch = maxHeapPerRowFetch;

  _executor = Executors.newThreadPool("index-manager", _threadCount);
  _mutateExecutor = Executors.newThreadPool("index-manager-mutate", _mutateThreadCount);
  if (facetThreadCount < 1) {
    _facetExecutor = null;
  } else {
    _facetExecutor = Executors.newThreadPool(new SynchronousQueue<Runnable>(), "facet-execution", facetThreadCount);
  }

  LOG.info("Init Complete");

}
 
開發者ID:apache,項目名稱:incubator-blur,代碼行數:41,代碼來源:IndexManager.java

示例5: newTimer

import com.yammer.metrics.Metrics; //導入方法依賴的package包/類
/**
 *
 * Return an existing timer if
 *  (a) A timer already exist with the same metric name.
 * Otherwise, creates a new timer and registers
 *
 * @param registry MetricsRegistry
 * @param name metric name
 * @param durationUnit TimeUnit for duration
 * @param rateUnit TimeUnit for rate determination
 * @return Timer
 */
public static Timer newTimer(MetricsRegistry registry, MetricName name, TimeUnit durationUnit, TimeUnit rateUnit) {
  if (registry != null) {
    return registry.newTimer(name, durationUnit, rateUnit);
  } else {
    return Metrics.newTimer(name, durationUnit, rateUnit);
  }
}
 
開發者ID:Hanmourang,項目名稱:Pinot,代碼行數:20,代碼來源:MetricsHelper.java


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