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


Java UniformReservoir类代码示例

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


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

示例1: forTestSetMetricsRegistryName

import com.codahale.metrics.UniformReservoir; //导入依赖的package包/类
@VisibleForTesting
@SuppressWarnings("unused")
public static void forTestSetMetricsRegistryName(String metricsRegistryName) {
  if (imStarted) {
    throw new IllegalStateException("Unit tests only!!!");
  }
  MetricRegistry metrics = SharedMetricRegistries.getOrCreate(metricsRegistryName);
  bambooReadTimer = new Timer();
  metrics.register("bambooReadTimer", bambooReadTimer);
  bambooParseTimer = new Timer();
  metrics.register("bambooParseTimer", bambooParseTimer);
  warcDocCountHistogram = new Histogram(new UniformReservoir());
  metrics.register("warcDocCountHistogram", warcDocCountHistogram);
  warcSizeHistogram = new Histogram(new UniformReservoir());
  metrics.register("warcSizeHistogram", warcSizeHistogram);
}
 
开发者ID:nla,项目名称:bamboo,代码行数:17,代码来源:BaseWarcDomainManager.java

示例2: create

import com.codahale.metrics.UniformReservoir; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public <T> T create(final Class<T> type) {

    if (type.equals(Meter.class)) {
        return (T) new Meter();
    }

    if (type.equals(Counter.class)) {
        return (T) new Counter();
    }

    if (type.equals(Histogram.class)) {
        return (T) new Histogram(new UniformReservoir());
    }

    return null;

}
 
开发者ID:mxro,项目名称:lightweight-java-metrics,代码行数:20,代码来源:MetricsFactory.java

示例3: testZipfian

import com.codahale.metrics.UniformReservoir; //导入依赖的package包/类
@Test
public void testZipfian()
throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException,
    IllegalArgumentException, InvocationTargetException {
  TestOptions opts = new PerformanceEvaluation.TestOptions();
  opts.setValueZipf(true);
  final int valueSize = 1024;
  opts.setValueSize(valueSize);
  RandomReadTest rrt = new RandomReadTest(null, opts, null);
  Constructor<?> ctor =
    Histogram.class.getDeclaredConstructor(com.codahale.metrics.Reservoir.class);
  ctor.setAccessible(true);
  Histogram histogram = (Histogram)ctor.newInstance(new UniformReservoir(1024 * 500));
  for (int i = 0; i < 100; i++) {
    histogram.update(rrt.getValueLength(null));
  }
  Snapshot snapshot = histogram.getSnapshot();
  double stddev = snapshot.getStdDev();
  assertTrue(stddev != 0 && stddev != 1.0);
  assertTrue(snapshot.getStdDev() != 0);
  double median = snapshot.getMedian();
  assertTrue(median != 0 && median != 1 && median != valueSize);
}
 
开发者ID:apache,项目名称:hbase,代码行数:24,代码来源:TestPerformanceEvaluation.java

示例4: startReconciliation

import com.codahale.metrics.UniformReservoir; //导入依赖的package包/类
public ReconciliationState startReconciliation() {
  final long taskReconciliationStartedAt = System.currentTimeMillis();

  if (!isRunningReconciliation.compareAndSet(false, true)) {
    LOG.info("Reconciliation is already running, NOT starting a new reconciliation process");
    return ReconciliationState.ALREADY_RUNNING;
  }

  if (!schedulerClient.isRunning()) {
    LOG.trace("Not running reconciliation - no active scheduler present");
    isRunningReconciliation.set(false);
    return ReconciliationState.NO_DRIVER;
  }

  final List<SingularityTaskId> activeTaskIds = taskManager.getActiveTaskIds();

  LOG.info("Starting a reconciliation cycle - {} current active tasks", activeTaskIds.size());

  schedulerClient.reconcile(Collections.emptyList());

  scheduleReconciliationCheck(taskReconciliationStartedAt, activeTaskIds, 0, new Histogram(new UniformReservoir()));

  return ReconciliationState.STARTED;
}
 
开发者ID:HubSpot,项目名称:Singularity,代码行数:25,代码来源:SingularityTaskReconciliation.java

示例5: initMetrics

import com.codahale.metrics.UniformReservoir; //导入依赖的package包/类
private void initMetrics() {
    //Main DB Metrics
    metrics.register(metricName("write"), new Timer(new UniformReservoir()));
    metrics.register(metricName("write.rate"), new Meter());
    metrics.register(metricName("read"), new Timer(new UniformReservoir()));
    metrics.register(metricName("read.rate"), new Meter());
    metrics.register(metricName("scan"), new Timer(new UniformReservoir()));
    metrics.register(metricName("scan.rate"), new Meter());

    //Write
    metrics.register(metricName("write.concurrentMemoryTableSerializers"), new Histogram(new UniformReservoir()));
    metrics.register(metricName("write.memoryTableSerialize"), new Timer(new UniformReservoir()));

    //Read
    metrics.register(metricName("read.tablesConsulted"), new Histogram(new UniformReservoir()));
    metrics.register(metricName("read.bloomFilterFalsePositiveRate"), new CacheHitGauge());
    metrics.register(metricName("read.recordNotFoundRate"), new CacheHitGauge());

    //FileTable
    metrics.register(metricName("table.cacheHitRate"), new CacheHitGauge());

    //Index
    metrics.register(metricName("index.searchLevels"), new Histogram(new UniformReservoir()));
    metrics.register(metricName("index.cacheHitRate"), new CacheHitGauge());

    //Compactor
    metrics.register(metricName("compactor.concurrentTasks"), new Histogram(new UniformReservoir()));
    metrics.register(metricName("compactor.taskExecution"), new Timer(new UniformReservoir()));
}
 
开发者ID:jordw,项目名称:heftydb,代码行数:30,代码来源:Metrics.java

示例6: testCreateTimer

import com.codahale.metrics.UniformReservoir; //导入依赖的package包/类
@Test
public void testCreateTimer() throws ReflectiveOperationException {
    final UniformTimingStrategy strategy = new UniformTimingStrategy();
    final Timer timer = strategy.createTimer(new MapConfig());
    UniformReservoir reservoir = reservoir(timer);
    assertNotNull(reservoir);
    assertEquals("uniform", strategy.name());
}
 
开发者ID:Microbule,项目名称:microbule,代码行数:9,代码来源:UniformTimingStrategyTest.java

示例7: getReservoir

import com.codahale.metrics.UniformReservoir; //导入依赖的package包/类
/**
 * Get reservoir implementation based on the reservoir type
 *
 * @return The {@link Reservoir} implementation
 */
private Reservoir getReservoir() {
    // The Reservoir implementation is selected using a switch statement.
    // The ReservoirType enum is a part of YAML configuration
    // and foreign imports are not supported by Carbon Configuration Maven Plugin.
    // Therefore, the Reservoir class cannot be imported and the Reservoir
    // creation logic cannot be written inside ReservoirType enum.
    switch (reservoirType) {
        case EXPONENTIALLY_DECAYING:
            return new ExponentiallyDecayingReservoir();
        case UNIFORM:
            return new UniformReservoir(reservoirParametersConfig.getSize());
        case SLIDING_WINDOW:
            return new SlidingWindowReservoir(reservoirParametersConfig.getSize());
        case SLIDING_TIME_WINDOW:
            return new SlidingTimeWindowReservoir(reservoirParametersConfig.getWindow(),
                    reservoirParametersConfig.getWindowUnit());
        case HDR_HISTOGRAM:
            Recorder recorder = new Recorder(reservoirParametersConfig.getNumberOfSignificantValueDigits());
            if (reservoirParametersConfig.isResetOnSnapshot()) {
                return new HdrHistogramResetOnSnapshotReservoir(recorder);
            } else {
                return new HdrHistogramReservoir(recorder);
            }
        default:
            throw new RuntimeException("Invalid Reservoir Type");

    }
}
 
开发者ID:wso2,项目名称:carbon-metrics,代码行数:34,代码来源:MetricManager.java

示例8: yearHistogram

import com.codahale.metrics.UniformReservoir; //导入依赖的package包/类
private Histogram yearHistogram(String year) {
  if (!yearSizes.containsKey(year)) {
    synchronized (yearSizes) {
      if (!yearSizes.containsKey(year)) {
        Histogram h = new Histogram(new UniformReservoir());
        metrics.register("size.year." + year, h);
        yearSizes.put(year, h);
      }
    }
  }
  return yearSizes.get(year);
}
 
开发者ID:nla,项目名称:bamboo,代码行数:13,代码来源:FilteringCoordinationService.java

示例9: lazyLoadByKey

import com.codahale.metrics.UniformReservoir; //导入依赖的package包/类
private void lazyLoadByKey(Map map, Object key, String prefix) {
  if (key == null) return;
  if (!map.containsKey(key)) {
    synchronized (map) {
      if (!map.containsKey(key)) {
        Histogram h = new Histogram(new UniformReservoir());
        metrics.register(prefix + key.toString().replaceAll("\\*", "star") + "", h);
        map.put(key, h);
      }
    }
  }
}
 
开发者ID:nla,项目名称:bamboo,代码行数:13,代码来源:FilteringCoordinationService.java

示例10: histograms

import com.codahale.metrics.UniformReservoir; //导入依赖的package包/类
@Test
public void histograms() throws Exception {
  MetricRegistry registry = new MetricRegistry();
  Histogram h = new Histogram(new UniformReservoir());
  registry.register("h", h);
  h.update(7);
  // result
  Map<String, Object> result = new TreeMap<>();
  result.put("histograms",
      ImmutableMap.of("h", ImmutableMap.builder()
          .put("max", 7D)
          .put("mean", 7D)
          .put("min", 7D)
          .put("p50", 7D)
          .put("p75", 7D)
          .put("p95", 7D)
          .put("p98", 7D)
          .put("p99", 7D)
          .put("p999", 7D)
          .put("values", Lists.newArrayList(7D))
          .build()));

  new MockUnit(Request.class, Response.class)
      .expect(registry(registry))
      .expect(name("name", Optional.empty()))
      .expect(param("type", "*"))
      .expect(param("unit", "seconds", "seconds"))
      .expect(bparam("showSamples", true))
      .expect(send(Status.OK, result))
      .run(unit -> {
        new MetricHandler().handle(unit.get(Request.class), unit.get(Response.class));
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:34,代码来源:MetricHandlerTest.java

示例11: createTimer

import com.codahale.metrics.UniformReservoir; //导入依赖的package包/类
@Override
public Timer createTimer(Config config) {
    return new Timer(new UniformReservoir(config.integerValue(SIZE_PROP).orElse(DEFAULT_SIZE)));
}
 
开发者ID:Microbule,项目名称:microbule,代码行数:5,代码来源:UniformTimingStrategy.java

示例12: newDomainFilterHistogram

import com.codahale.metrics.UniformReservoir; //导入依赖的package包/类
private void newDomainFilterHistogram(String rules, String metricsName) {
  Histogram h = new Histogram(new UniformReservoir());
  domainSizes.put(new SurtFilter(rules), h);
  metrics.register(metricsName, h);
}
 
开发者ID:nla,项目名称:bamboo,代码行数:6,代码来源:FilteringCoordinationService.java

示例13: startMe

import com.codahale.metrics.UniformReservoir; //导入依赖的package包/类
protected static synchronized void startMe(FilteringCoordinationService filtering, boolean indexFullText) {
  if (imStarted) {
    throw new IllegalStateException("You started me twice!");
  }
log.info("Bamboo Base URL  : {}", bambooBaseUrl);
log.info("Metrics registry : {}", filtering.getMetricsRegistryName());
log.info("# Filters        : {}", filterPoolLimit);
log.info("# Transformers   : {}", transformPoolLimit);
log.info("# Indexers       : {}", indexPoolLimit);

  // Metrics are fun...
  MetricRegistry metrics = SharedMetricRegistries.getOrCreate(filtering.getMetricsRegistryName());
  bambooReadTimer = new Timer();
  metrics.register("bambooReadTimer", bambooReadTimer);
  bambooParseTimer = new Timer();
  metrics.register("bambooParseTimer", bambooParseTimer);
  Gauge<Long> bambooCacheNull = () -> bambooCacheNullLong;
  metrics.register("bambooCacheNull", bambooCacheNull);
  Gauge<Long> bambooCacheHit = () -> bambooCacheHitLong;
  metrics.register("bambooCacheHit", bambooCacheHit);
  Gauge<Long> bambooCacheMiss = () -> bambooCacheMissLong;
  metrics.register("bambooCacheMiss", bambooCacheMiss);
  warcDocCountHistogram = new Histogram(new UniformReservoir());
  metrics.register("warcDocCountHistogram", warcDocCountHistogram);
  warcSizeHistogram = new Histogram(new UniformReservoir());
  metrics.register("warcSizeHistogram", warcSizeHistogram);
  Timer filterTimer = new Timer();
  metrics.register("filterTimer", filterTimer);
  Timer transformTimer = new Timer();
  metrics.register("transformTimer", transformTimer);
  Timer indexTimer = new Timer();
  metrics.register("indexTimer", indexTimer);

  // Filter workers
  WorkProcessor filterPool = new WorkProcessor(filterPoolLimit);
  for (int i = 0; i < filterPoolLimit; i++) {
    filterPool.process(new FilterWorker(filtering, filterTimer));
  }

  // Transform workers
  WorkProcessor transformPool = new WorkProcessor(transformPoolLimit);
  for (int i = 0; i < transformPoolLimit; i++) {
    transformPool.process(new TransformWorker(transformTimer, indexFullText));
  }

  // Indexing workers
  WorkProcessor indexPool = new WorkProcessor(indexPoolLimit);
  for (int i = 0; i < indexPoolLimit; i++) {
    indexPool.process(new IndexerWorker(indexTimer));
  }

  imStarted = true;
}
 
开发者ID:nla,项目名称:bamboo,代码行数:54,代码来源:BaseWarcDomainManager.java

示例14: testSetup

import com.codahale.metrics.UniformReservoir; //导入依赖的package包/类
void testSetup() throws IOException {
  createConnection();
  onStartup();
  latencyHistogram = YammerHistogramUtils.newHistogram(new UniformReservoir(1024 * 500));
  valueSizeHistogram = YammerHistogramUtils.newHistogram(new UniformReservoir(1024 * 500));
}
 
开发者ID:apache,项目名称:hbase,代码行数:7,代码来源:PerformanceEvaluation.java

示例15: newInstance

import com.codahale.metrics.UniformReservoir; //导入依赖的package包/类
public IQDigest newInstance(long factor)
{
    return new MetricsHistogram(new UniformReservoir());
}
 
开发者ID:koron,项目名称:qdigest-benchmark,代码行数:5,代码来源:MetricsHistogramFactory.java


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