当前位置: 首页>>代码示例>>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;未经允许,请勿转载。