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


Java Histogram.outputPercentileDistribution方法代碼示例

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


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

示例1: main

import org.HdrHistogram.Histogram; //導入方法依賴的package包/類
public static void main(String[] args) throws SuspendExecution, InterruptedException {
  final IntervalGenerator intervalGen = new ConstantIntervalGenerator(10000000);
  final RequestExecutor<EchoRequest, EchoResponse> requestExector = new EchoRequestExecutor();

  final Channel<EchoRequest> requestCh = Channels.newChannel(-1);
  final Channel<TimingEvent<EchoResponse>> eventCh = Channels.newChannel(-1);

  // Requests generator
  new Fiber<Void>("req-gen", () -> {
    for (int i=0; i < 1000; ++i) {
      final EchoRequest req = new EchoRequest();
      req.setMessage("foo");
      requestCh.send(req);
    }

    requestCh.close();
  }).start();

  final Histogram histogram = new Histogram(3600000000L, 3);
  // Event recording, both HistHDR and logging
  record(eventCh, new HdrHistogramRecorder(histogram, 1000000), new LoggingRecorder(LOG));

  JBender.loadTestThroughput(intervalGen, 0, requestCh, requestExector, eventCh);

  histogram.outputPercentileDistribution(System.out, 1000.0);
}
 
開發者ID:pinterest,項目名稱:jbender,代碼行數:27,代碼來源:Main.java

示例2: exmapleUsageTest

import org.HdrHistogram.Histogram; //導入方法依賴的package包/類
@Ignore
public void exmapleUsageTest() {
   
    
    CPUMonitor monitor = new CPUMonitor(200); //5 per second
    
    monitor.start();
    
    try {
        Thread.sleep(900);
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
       return;
    }
            
    Histogram histogram = monitor.stop();
    assertTrue(null!=histogram);
    if (histogram.getTotalCount()>0) {//some platforms do not support this monitor.
        assertEquals(5, histogram.getTotalCount());
    }
    PrintStream printStream = new PrintStream(new ByteArrayOutputStream());
    
    histogram.outputPercentileDistribution(printStream, CPUMonitor.UNIT_SCALING_RATIO);
    
    
}
 
開發者ID:oci-pronghorn,項目名稱:PronghornPipes,代碼行數:27,代碼來源:CPUMonitorTest.java

示例3: printHistogram

import org.HdrHistogram.Histogram; //導入方法依賴的package包/類
public static void printHistogram(final Histogram histogram) {
    System.out.println("Percentiles (micros)");
    System.out.println("\t90%    : " + histogram.getValueAtPercentile(90)/1000f);
    System.out.println("\t99%    : " + histogram.getValueAtPercentile(99)/1000f);
    System.out.println("\t99.9%  : " + histogram.getValueAtPercentile(99.9)/1000f);
    System.out.println("\t99.99% : " + histogram.getValueAtPercentile(99.99)/1000f);
    System.out.println("\t99.999%: " + histogram.getValueAtPercentile(99.999)/1000f);
    System.out.println("\tmax    : " + histogram.getMaxValue()/1000f);
    System.out.println();
    System.out.println("Histogram (micros):");
    histogram.outputPercentileDistribution(System.out, 1000.0);
}
 
開發者ID:terzerm,項目名稱:fx-highway,代碼行數:13,代碼來源:HistogramPrinter.java

示例4: main

import org.HdrHistogram.Histogram; //導入方法依賴的package包/類
public static void main(final String[] args) throws SuspendExecution, InterruptedException, ExecutionException, IOReactorException, IOException {
  final IntervalGenerator intervalGenerator = new ConstantIntervalGenerator(10000000);
  try (final FiberApacheHttpClientRequestExecutor requestExecutor =
          new FiberApacheHttpClientRequestExecutor<>((res) -> {
            if (res == null) {
              throw new AssertionError("Response is null");
            }
            final int status = res.getStatusLine().getStatusCode();
            if (status != 200) {
              throw new AssertionError("Status is " + status);
            }
          }, 1000000)) {

    final Channel<HttpGet> requestCh = Channels.newChannel(1000);
    final Channel<TimingEvent<CloseableHttpResponse>> eventCh = Channels.newChannel(1000);

    // Requests generator
    new Fiber<Void>("req-gen", () -> {
      // Bench handling 1k reqs
      for (int i = 0; i < 1000; ++i) {
        requestCh.send(new HttpGet("http://localhost:8080/hello-world"));
      }

      requestCh.close();
    }).start();

    final Histogram histogram = new Histogram(3600000000L, 3);

    // Event recording, both HistHDR and logging
    record(eventCh, new HdrHistogramRecorder(histogram, 1000000), new LoggingRecorder(LOG));

    // Main
    new Fiber<Void>("jbender", () -> {
      JBender.loadTestThroughput(intervalGenerator, 0, requestCh, requestExecutor, eventCh);
    }).start().join();

    histogram.outputPercentileDistribution(System.out, 1000.0);
  }
}
 
開發者ID:pinterest,項目名稱:jbender,代碼行數:40,代碼來源:LoadTest.java

示例5: histogramToString

import org.HdrHistogram.Histogram; //導入方法依賴的package包/類
public static String histogramToString(Histogram histogram) {
    try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
        PrintStream writer = new PrintStream(baos);
        histogram.outputPercentileDistribution(writer, 1.0);
        byte[] resultBytes = baos.toByteArray();
        return new String(resultBytes);
    } catch (IOException e) {
        throw new IllegalStateException(e);
    }
}
 
開發者ID:vladimir-bukhtoyarov,項目名稱:rolling-metrics,代碼行數:11,代碼來源:Printer.java

示例6: dumpHistogram

import org.HdrHistogram.Histogram; //導入方法依賴的package包/類
private static void dumpHistogram(final Histogram histogram, final PrintStream out)
{
    histogram.outputPercentileDistribution(out, 1, 1000.0);
}
 
開發者ID:winwill2012,項目名稱:disruptor-code-analysis,代碼行數:5,代碼來源:PingPongSequencedLatencyTest.java


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