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


Java Snapshot.getStdDev方法代碼示例

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


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

示例1: reportHistograms

import com.codahale.metrics.Snapshot; //導入方法依賴的package包/類
private void reportHistograms(final long timestamp, final SortedMap<String, Histogram> histograms) {
    Object[] meta = new Object[]{timestamp};
    for (Map.Entry<String, Histogram> entry : histograms.entrySet()) {
        String name = entry.getKey();
        Histogram histogram = entry.getValue();
        Snapshot snapshot = histogram.getSnapshot();
        Object[] payload = new Object[13];
        payload[0] = source;
        payload[1] = name;
        payload[2] = histogram.getCount();
        payload[3] = snapshot.getMax();
        payload[4] = snapshot.getMean();
        payload[5] = snapshot.getMin();
        payload[6] = snapshot.getStdDev();
        payload[7] = snapshot.getMedian();
        payload[8] = snapshot.get75thPercentile();
        payload[9] = snapshot.get95thPercentile();
        payload[10] = snapshot.get98thPercentile();
        payload[11] = snapshot.get99thPercentile();
        payload[12] = snapshot.get999thPercentile();
        Event event = new Event(HISTOGRAM_STREAM_ID, timestamp, meta, null, payload);
        dataPublisher.publish(event);
    }
}
 
開發者ID:wso2,項目名稱:carbon-metrics,代碼行數:25,代碼來源:DasReporter.java

示例2: testZipfian

import com.codahale.metrics.Snapshot; //導入方法依賴的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

示例3: reportHistogram

import com.codahale.metrics.Snapshot; //導入方法依賴的package包/類
private void reportHistogram(String name, Histogram histogram, long timestamp) {
	if (canSkipMetric(name, histogram)) {
		return;
	}
	final Snapshot snapshot = histogram.getSnapshot();
	Object[] p = pointsHistogram[0];
	p[0] = influxdb.convertTimestamp(timestamp);
	p[1] = snapshot.size();
	p[2] = snapshot.getMin();
	p[3] = snapshot.getMax();
	p[4] = snapshot.getMean();
	p[5] = snapshot.getStdDev();
	p[6] = snapshot.getMedian();
	p[7] = snapshot.get75thPercentile();
	p[8] = snapshot.get95thPercentile();
	p[9] = snapshot.get99thPercentile();
	p[10] = snapshot.get999thPercentile();
	p[11] = histogram.getCount();
	assert (p.length == COLUMNS_HISTOGRAM.length);
	influxdb.appendSeries(prefix, name, ".histogram", COLUMNS_HISTOGRAM, pointsHistogram);
}
 
開發者ID:davidB,項目名稱:metrics-influxdb,代碼行數:22,代碼來源:ReporterV08.java

示例4: serialise

import com.codahale.metrics.Snapshot; //導入方法依賴的package包/類
public MetricsHistogram serialise(String name, Histogram histo)
{
	Snapshot snapshot = histo.getSnapshot();
	final long count = histo.getCount();
	return new MetricsHistogram(name,
	                            count,
	                            snapshot.size(),
	                            snapshot.getMin(),
	                            snapshot.getMax(),
	                            snapshot.getStdDev(),
	                            snapshot.getMean(),
	                            snapshot.getMedian(),
	                            snapshot.get75thPercentile(),
	                            snapshot.get95thPercentile(),
	                            snapshot.get98thPercentile(),
	                            snapshot.get99thPercentile(),
	                            snapshot.get999thPercentile());
}
 
開發者ID:petergeneric,項目名稱:stdlib,代碼行數:19,代碼來源:MetricSerialiser.java

示例5: HistogramEntity

import com.codahale.metrics.Snapshot; //導入方法依賴的package包/類
public HistogramEntity(final Snapshot snapshot) {
    max = snapshot.getMax();
    mean = snapshot.getMean();
    min = snapshot.getMin();
    stdDev = snapshot.getStdDev();
    median = snapshot.getMedian();
    p75 = snapshot.get75thPercentile();
    p95 = snapshot.get95thPercentile();
    p98 = snapshot.get98thPercentile();
    p99 = snapshot.get99thPercentile();
    p999 = snapshot.get999thPercentile();
}
 
開發者ID:quanticc,項目名稱:ugc-bot-redux,代碼行數:13,代碼來源:HistogramEntity.java

示例6: reportTimer

import com.codahale.metrics.Snapshot; //導入方法依賴的package包/類
private void reportTimer(String name, Timer timer, long timestamp, List<String> tags)
    throws IOException {
  final Snapshot snapshot = timer.getSnapshot();

  LOG.debug("Timer[" +name + "] " + timer);
  if(timer instanceof HistImplContainer) {
    HistImpl take = ((HistImplContainer)timer).getHistImpl().copyAndReset();
    LOG.debug("Adding Circonus Histogram to report: " + name);
    request.addHistogram(new CirconusHistogram(
          name, take, timestamp, host, tags));
    if(suppress_bad_analytics) return;
  }

  double[] values = { snapshot.getMax(), snapshot.getMean(), snapshot.getMin(), snapshot.getStdDev(),
      snapshot.getMedian(), snapshot.get75thPercentile(), snapshot.get95thPercentile(), snapshot.get98thPercentile(),
      snapshot.get99thPercentile(), snapshot.get999thPercentile() };

  for (int i = 0; i < STATS_EXPANSIONS.length; i++) {
    if (expansions.contains(STATS_EXPANSIONS[i])) {
      request.addGauge(new CirconusGauge(
          appendExpansionSuffix(name, STATS_EXPANSIONS[i]),
          toNumber(convertDuration(values[i])),
          timestamp,
          host,
          tags));
    }
  }

  reportMetered(name, timer, timestamp, tags);
}
 
開發者ID:circonus-labs,項目名稱:metrics-circonus,代碼行數:31,代碼來源:CirconusReporter.java

示例7: reportHistogram

import com.codahale.metrics.Snapshot; //導入方法依賴的package包/類
private void reportHistogram(String name, Histogram histogram, long timestamp, List<String> tags)
    throws IOException {
  final Snapshot snapshot = histogram.getSnapshot();

  if(histogram instanceof HistImplContainer) {
    HistImpl take = ((HistImplContainer)histogram).getHistImpl().copyAndReset();
    LOG.debug("Adding Circonus Histogram to report: " + name);
    request.addHistogram(new CirconusHistogram(
          name, take, timestamp, host, tags));
    if(suppress_bad_analytics) return;
  }

  if (expansions.contains(Expansion.COUNT)) {
    request.addGauge(new CirconusGauge(
        appendExpansionSuffix(name, Expansion.COUNT),
        histogram.getCount(),
        timestamp,
        host,
        tags));
  }

  Number[] values = { snapshot.getMax(), snapshot.getMean(), snapshot.getMin(), snapshot.getStdDev(),
      snapshot.getMedian(), snapshot.get75thPercentile(), snapshot.get95thPercentile(), snapshot.get98thPercentile(),
      snapshot.get99thPercentile(), snapshot.get999thPercentile() };

  for (int i = 0; i < STATS_EXPANSIONS.length; i++) {
    if (expansions.contains(STATS_EXPANSIONS[i])) {
      request.addGauge(new CirconusGauge(
          appendExpansionSuffix(name, STATS_EXPANSIONS[i]),
          toNumber(values[i]),
          timestamp,
          host,
          tags));
    }
  }
}
 
開發者ID:circonus-labs,項目名稱:metrics-circonus,代碼行數:37,代碼來源:CirconusReporter.java

示例8: SamplingAdapter

import com.codahale.metrics.Snapshot; //導入方法依賴的package包/類
public SamplingAdapter(Sampling samplingMetric, String name, String description, Unit<?> unit) {
    this.samplingMetric = samplingMetric;
    Snapshot snapshot = samplingMetric.getSnapshot();
    this.mean = new NonSelfRegisteringSettableValue<>(name(name, "mean"), description + " - Mean", unit, snapshot.getMean(), ValueSemantics.FREE_RUNNING);
    this.seventyFifthPercentile = new NonSelfRegisteringSettableValue<>(name(name, "seventyfifth"), description + " - 75th Percentile of recent data", unit, snapshot.get75thPercentile(), ValueSemantics.FREE_RUNNING);
    this.ninetyFifthPercentile = new NonSelfRegisteringSettableValue<>(name(name, "ninetyfifth"), description + " - 95th Percentile of recent data", unit, snapshot.get95thPercentile(), ValueSemantics.FREE_RUNNING);
    this.ninetyEighthPercentile = new NonSelfRegisteringSettableValue<>(name(name, "ninetyeighth"), description + " - 98th Percentile of recent data", unit, snapshot.get98thPercentile(), ValueSemantics.FREE_RUNNING);
    this.ninetyNinthPercentile = new NonSelfRegisteringSettableValue<>(name(name, "ninetynineth"), description + " - 99th Percentile of recent data", unit, snapshot.get99thPercentile(), ValueSemantics.FREE_RUNNING);
    this.threeNinesPercentile = new NonSelfRegisteringSettableValue<>(name(name, "threenines"), description + " - 99.9th Percentile of recent data", unit, snapshot.get999thPercentile(), ValueSemantics.FREE_RUNNING);

    this.median = new NonSelfRegisteringSettableValue<>(name(name, "median"), description + " - Median", unit, snapshot.getMedian(), ValueSemantics.FREE_RUNNING);
    this.max = new NonSelfRegisteringSettableValue<>(name(name, "max"), description + " - Maximum", unit, snapshot.getMax(), ValueSemantics.MONOTONICALLY_INCREASING);
    this.min = new NonSelfRegisteringSettableValue<>(name(name, "min"), description + " - Minimum", unit, snapshot.getMin(), ValueSemantics.FREE_RUNNING);
    this.stddev = new NonSelfRegisteringSettableValue<>(name(name, "stddev"), description + " - Standard Deviation", unit, snapshot.getStdDev(), ValueSemantics.FREE_RUNNING);
}
 
開發者ID:performancecopilot,項目名稱:parfait,代碼行數:16,代碼來源:SamplingAdapter.java

示例9: reportHistogramSnapshot

import com.codahale.metrics.Snapshot; //導入方法依賴的package包/類
private String reportHistogramSnapshot(Snapshot snapshot) {
	return "min=" + snapshot.getMin() + ","
			+ "max=" + snapshot.getMax() + ","
			+ "mean=" + snapshot.getMean() + ","
			+ "p50=" + snapshot.getMedian() + ","
			+ "std=" + snapshot.getStdDev() + ","
			+ "p25=" + snapshot.getValue(0.25) + ","
			+ "p75=" + snapshot.get75thPercentile() + ","
			+ "p95=" + snapshot.get95thPercentile() + ","
			+ "p98=" + snapshot.get98thPercentile() + ","
			+ "p99=" + snapshot.get99thPercentile() + ","
			+ "p999=" + snapshot.get999thPercentile();
}
 
開發者ID:stagemonitor,項目名稱:stagemonitor,代碼行數:14,代碼來源:InfluxDbReporter.java

示例10: testBasicStatisticsHighRate

import com.codahale.metrics.Snapshot; //導入方法依賴的package包/類
@Test
public void testBasicStatisticsHighRate() throws Exception {
    final DeterministicClock clock = new DeterministicClock();

    int iterations = 2;
    for (int iteration = 0; iteration < iterations; iteration++) {
        final Reservoir delegate = new ExponentiallyDecayingReservoir(1028, 0.015, clock);
        final MinMaxSlidingTimeReservoir reservoir =
            new MinMaxSlidingTimeReservoir(clock, SIZE, STEP, TimeUnit.NANOSECONDS, delegate);

        int numSamples = 1000000;
        int clockInterval = numSamples / SIZE;
        long exactValues[] = new long[numSamples + 2];
        long maxPos = ThreadLocalRandom.current().nextInt(0, numSamples);
        long minPos = ThreadLocalRandom.current().nextInt(0, numSamples);
        int i = 0;
        for (long pos = 0; pos < numSamples; pos++) {
            if (pos > 0 && pos % clockInterval == 0) {
                clock.add(STEP);
            }
            long val = ThreadLocalRandom.current().nextLong(-VALUE_RANGE, VALUE_RANGE);
            reservoir.update(val);
            exactValues[i] = val;
            i++;
            // Insert an extreme max / min value at a random point in the reservoir
            if (pos == maxPos) {
                reservoir.update(MAX_VALUE);
                exactValues[i] = MAX_VALUE;
                i++;
            }
            if (pos == minPos) {
                reservoir.update(MIN_VALUE);
                exactValues[i] = MIN_VALUE;
                i++;
            }
        }

        final Snapshot snapshot = reservoir.getSnapshot();

        assertEquals("Max value", MAX_VALUE, snapshot.getMax());
        assertEquals("Min value", MIN_VALUE, snapshot.getMin());

        final long actualValues[] = Arrays.copyOf(snapshot.getValues(), snapshot.getValues().length);
        assertTrue("Reservoir contains values", actualValues.length > 1000);

        final Set<Long> exactValueSet = new HashSet<>();
        for (i = 0; i < exactValues.length; i++) {
            exactValueSet.add(exactValues[i]);
        }
        assertTrue("Only known values in the reservoir", Arrays
            .stream(actualValues)
            .filter(value -> !exactValueSet.contains(value))
            .count() == 0);

        final long zeroValueRange = (VALUE_RANGE * 10) / 100;
        assertThat("Mean value is within 10% error rate of 0", (long) snapshot.getMean(),
            allOf(greaterThan(-zeroValueRange), lessThan(zeroValueRange)));

        final long stdDev = (long) snapshot.getStdDev();
        assertThat("Mean deviation is more than 40% of value range", stdDev,
            greaterThan((VALUE_RANGE * 40) / 100));
        assertThat("Mean deviation is less than the max value range", stdDev,
            lessThan(MAX_VALUE));

        final Snapshot snapshot2 = reservoir.getSnapshot();
        assertArrayEquals("Two calls to get snapshot results in same data",
            snapshot.getValues(), snapshot2.getValues());
    }
}
 
開發者ID:spotify,項目名稱:heroic,代碼行數:70,代碼來源:MinMaxSlidingTimeReservoirIT.java


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