org.HdrHistogram.Histogram.decodeFromByteBuffer()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中org.HdrHistogram.Histogram.decodeFromByteBuffer()方法的一些代码示例,展示了Histogram.decodeFromByteBuffer()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Histogram.decodeFromByteBuffer()方法的具体详情如下:
包路径:org.HdrHistogram.Histogram
类名称:Histogram
方法名:decodeFromByteBuffer

Histogram.decodeFromByteBuffer介绍

暂无

代码示例

代码示例来源:origin: HdrHistogram/HdrHistogram

/**
 * Construct a new histogram by decoding it from a ByteBuffer.
 * @param buffer The buffer to decode from
 * @param minBarForHighestTrackableValue Force highestTrackableValue to be set at least this high
 * @return The newly constructed histogram
 */
public static Histogram decodeFromByteBuffer(final ByteBuffer buffer,
                       final long minBarForHighestTrackableValue) {
  return (Histogram) decodeFromByteBuffer(buffer, Histogram.class, minBarForHighestTrackableValue);
}

代码示例来源:origin: glowroot/glowroot

public LazyHistogram(Aggregate.Histogram hist) {
  ByteString encodedBytes = hist.getEncodedBytes();
  if (encodedBytes.isEmpty()) {
    List<Long> orderedRawValues = hist.getOrderedRawValueList();
    values = new long[orderedRawValues.size()];
    for (int i = 0; i < values.length; i++) {
      values[i] = orderedRawValues.get(i);
    }
    size = values.length;
  } else {
    histogram = Histogram.decodeFromByteBuffer(encodedBytes.asReadOnlyByteBuffer(), 0);
  }
}

代码示例来源:origin: glowroot/glowroot

public void merge(Aggregate.Histogram toBeMergedHistogram) {
  ByteString encodedBytes = toBeMergedHistogram.getEncodedBytes();
  if (encodedBytes.isEmpty()) {
    for (long rawValue : toBeMergedHistogram.getOrderedRawValueList()) {
      add(rawValue);
    }
  } else {
    if (histogram == null) {
      convertValuesToHistogram();
    }
    histogram.add(Histogram.decodeFromByteBuffer(encodedBytes.asReadOnlyByteBuffer(), 0));
  }
}

代码示例来源:origin: org.hdrhistogram/HdrHistogram

/**
 * Construct a new histogram by decoding it from a ByteBuffer.
 * @param buffer The buffer to decode from
 * @param minBarForHighestTrackableValue Force highestTrackableValue to be set at least this high
 * @return The newly constructed histogram
 */
public static Histogram decodeFromByteBuffer(final ByteBuffer buffer,
                       final long minBarForHighestTrackableValue) {
  return (Histogram) decodeFromByteBuffer(buffer, Histogram.class, minBarForHighestTrackableValue);
}

代码示例来源:origin: real-logic/artio

public int read(final HistogramLogHandler handler) throws IOException
{
  remapIfExpanded();
  final int timerCount = idToName.size();
  int samplesRead = 0;
  while (true)
  {
    if (buffer.remaining() < SIZE_OF_LONG)
    {
      return samplesRead;
    }
    buffer.mark();
    final long timeStamp = buffer.getLong();
    if (timeStamp == 0)
    {
      buffer.reset();
      return samplesRead;
    }
    for (int i = 0; i < timerCount; i++)
    {
      final int id = buffer.getInt();
      final String name = idToName.get(id);
      final Histogram histogram = Histogram.decodeFromByteBuffer(buffer, 0);
      handler.onHistogram(timeStamp, name, histogram);
    }
    samplesRead++;
  }
}

相关文章