本文整理了Java中com.yammer.metrics.core.Histogram.count()
方法的一些代码示例,展示了Histogram.count()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Histogram.count()
方法的具体详情如下:
包路径:com.yammer.metrics.core.Histogram
类名称:Histogram
方法名:count
[英]Returns the number of values recorded.
[中]返回记录的值的数目。
代码示例来源:origin: apache/incubator-pinot
@Override
public String toString() {
return "NettyServerMetric [_requestsReceived=" + _requestsReceived.count() + ", _bytesSent=" + _bytesSent.count()
+ ", _bytesReceived=" + _bytesReceived.count() + ", _errors=" + _errors.count() + ", _sendResponseMsGauge="
+ _sendResponseMsHistogram.count() + ", _processingLatencyMsGauge=" + _processingLatencyMsHistogram.count()
+ "]";
}
代码示例来源:origin: apache/incubator-pinot
@Override
public String toString() {
return "NettyClientMetric [_requestsSent=" + _requestsSent.count() + ", _bytesSent=" + _bytesSent.count()
+ ", _bytesReceived=" + _bytesReceived.count() + ", _errors=" + _errors.count() + ", _sendRequestMsGauge="
+ _sendRequestMsHistogram.count() + ", _responseLatencyMsGauge=" + _responseLatencyMsHistogram.count()
+ ", _connectMsGauge=" + _connectMsGauge.value() + "]";
}
代码示例来源:origin: com.yammer.metrics/metrics-core
@Override
public long count() {
return histogram.count();
}
代码示例来源:origin: com.yammer.metrics/metrics-core
@Override
public long getCount() {
return metric.count();
}
代码示例来源:origin: com.yammer.metrics/metrics-core
private double variance() {
if (count() <= 1) {
return 0.0;
}
return variance.get()[1] / (count() - 1);
}
代码示例来源:origin: com.yammer.metrics/metrics-core
@Override
public double mean() {
if (count() > 0) {
return sum.get() / (double) count();
}
return 0.0;
}
代码示例来源:origin: com.yammer.metrics/metrics-core
@Override
public double max() {
if (count() > 0) {
return max.get();
}
return 0.0;
}
代码示例来源:origin: com.yammer.metrics/metrics-core
@Override
public double min() {
if (count() > 0) {
return min.get();
}
return 0.0;
}
代码示例来源:origin: com.yammer.metrics/metrics-core
private void updateVariance(long value) {
while (true) {
final double[] oldValues = variance.get();
final double[] newValues = new double[2];
if (oldValues[0] == -1) {
newValues[0] = value;
newValues[1] = 0;
} else {
final double oldM = oldValues[0];
final double oldS = oldValues[1];
final double newM = oldM + ((value - oldM) / count());
final double newS = oldS + ((value - oldM) * (value - newM));
newValues[0] = newM;
newValues[1] = newS;
}
if (variance.compareAndSet(oldValues, newValues)) {
return;
}
}
}
代码示例来源:origin: com.yammer.metrics/metrics-core
@Override
public double stdDev() {
if (count() > 0) {
return sqrt(variance());
}
return 0.0;
}
代码示例来源:origin: harbby/presto-connectors
@Override
public void processHistogram(MetricName name, Histogram histogram, PrintStream stream) {
super.processHistogram(name, histogram, stream);
stream.printf(Locale.getDefault(), " count = %d%n", histogram.count());
}
}
代码示例来源:origin: org.apache.giraph/giraph-core
@Override
public void processHistogram(MetricName name, Histogram histogram,
PrintStream stream) {
stream.printf(" sum = %,2.2f%n", histogram.sum());
super.processHistogram(name, histogram, stream);
stream.printf(" count = %d%n", histogram.count());
}
} .run();
代码示例来源:origin: com.wavefront/java-lib
private void internalProcessYammerHistogram(Histogram histogram, Context context) throws Exception {
final JsonGenerator json = context.json;
json.writeStartObject();
{
json.writeNumberField("count", histogram.count());
writeSummarizable(histogram, json);
writeSampling(histogram, json);
if (context.showFullSamples) {
json.writeObjectField("values", histogram.getSnapshot().getValues());
}
if (clear) histogram.clear();
}
json.writeEndObject();
}
代码示例来源:origin: wavefrontHQ/java
private void internalProcessYammerHistogram(Histogram histogram, Context context) throws Exception {
final JsonGenerator json = context.json;
json.writeStartObject();
{
json.writeNumberField("count", histogram.count());
writeSummarizable(histogram, json);
writeSampling(histogram, json);
if (context.showFullSamples) {
json.writeObjectField("values", histogram.getSnapshot().getValues());
}
if (clear) histogram.clear();
}
json.writeEndObject();
}
代码示例来源:origin: com.yammer.metrics/metrics-servlet
@Override
public void processHistogram(MetricName name, Histogram histogram, Context context) throws Exception {
final JsonGenerator json = context.json;
json.writeStartObject();
{
json.writeStringField("type", "histogram");
json.writeNumberField("count", histogram.count());
writeSummarizable(histogram, json);
writeSampling(histogram, json);
if (context.showFullSamples) {
json.writeObjectField("values", histogram.getSnapshot().getValues());
}
}
json.writeEndObject();
}
代码示例来源:origin: com.wavefront/proxy
/**
* @return bytes per minute for requests submissions. Null if no data is available yet.
*/
@Nullable
public Long getBytesPerMinute() {
if (resultPostingMeter.fifteenMinuteRate() == 0 || resultPostingSizes.mean() == 0 || resultPostingSizes.count() <
50) {
return null;
}
return (long) (resultPostingSizes.mean() * resultPostingMeter.fifteenMinuteRate());
}
代码示例来源:origin: wavefrontHQ/java
/**
* @return bytes per minute for requests submissions. Null if no data is available yet.
*/
@Nullable
public Long getBytesPerMinute() {
if (resultPostingMeter.fifteenMinuteRate() == 0 || resultPostingSizes.mean() == 0 || resultPostingSizes.count() <
50) {
return null;
}
return (long) (resultPostingSizes.mean() * resultPostingMeter.fifteenMinuteRate());
}
代码示例来源:origin: amient/kafka-metrics
@Override
public void processHistogram(MetricName name, Histogram histogram, Long timestamp) {
Map<String, Double> fields = new HashMap<String, Double>();
fields.put("Count", Double.valueOf(histogram.count()));
fields.put("Max", histogram.max());
fields.put("Mean", histogram.mean());
fields.put("Min", histogram.min());
fields.put("StdDev", histogram.stdDev());
fields.put("Sum", histogram.sum());
Snapshot snapshot = histogram.getSnapshot();
fields.put("95thPercentile", snapshot.get95thPercentile());
fields.put("98thPercentile", snapshot.get98thPercentile());
fields.put("99thPercentile", snapshot.get99thPercentile());
fields.put("999thPercentile", snapshot.get999thPercentile());
publish(createMeasurement(name, timestamp, fixedTags, fields));
}
代码示例来源:origin: addthis/MetricCatcher
@Test
public void testUpdateMetric_Histogram_Biased() {
jsonMetric.setType("biased");
Histogram metric = (Histogram) metricCatcher.createMetric(jsonMetric);
metricCatcher.updateMetric(metric, 1);
assertEquals(1, metric.count());
}
代码示例来源:origin: addthis/MetricCatcher
@Test
public void testUpdateMetric_Histogram_MultipleUpdates() {
jsonMetric.setType("biased");
Histogram metric = (Histogram) metricCatcher.createMetric(jsonMetric);
int count = 7;
for (int x = 0; x < 7; x++) {
metricCatcher.updateMetric(metric, 1);
}
assertEquals(count, metric.count());
}
内容来源于网络,如有侵权,请联系作者删除!