/*
 * Copyright 2014 Timothy Brooks
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package net.uncontended.precipice.reporting;

import io.undertow.Undertow;
import io.undertow.server.handlers.PathHandler;
import io.undertow.server.handlers.resource.ClassPathResourceManager;
import org.HdrHistogram.Histogram;

import java.util.concurrent.TimeUnit;

import static io.undertow.Handlers.resource;

public class Entry {

    public static void main(String[] args) {
//        PathHandler path = new PathHandler()
//                .addPrefixPath("/", resource(new ClassPathResourceManager(Dashboard.class.getClassLoader(),
//                        Dashboard.class.getPackage())).addWelcomeFiles("chart.html"))
//                .addExactPath("/api", new Dashboard());
//
//        Undertow server = Undertow.builder()
//                .addHttpListener(6001, "127.0.0.1")
//                .setHandler(path)
//                .build();
//        server.start();
//
//        try {
//            Thread.sleep(1000000000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
//        server.stop();

        Histogram histogram = new Histogram(1000, TimeUnit.HOURS.toNanos(1), 2);
        histogram.recordValue(2);
        histogram.recordValue(2);
        histogram.recordValue(2);
        histogram.recordValue(2);
        histogram.recordValue(2000);
        histogram.recordValue(3000);
        histogram.recordValue(5000);
        histogram.recordValue(TimeUnit.HOURS.toNanos(1));

        System.out.println(histogram.getValueAtPercentile(50.0));
        System.out.println(histogram.getValueAtPercentile(90.0));
        System.out.println(histogram.getValueAtPercentile(99.0));
        System.out.println(histogram.getValueAtPercentile(99.9));
        System.out.println(histogram.getValueAtPercentile(99.99));
        System.out.println(histogram.getValueAtPercentile(99.999));
        System.out.println(histogram.getMaxValue());

        histogram.outputPercentileDistribution(System.out, 1000.0);
    }
}

@@ -787,82 +787,8 @@
 ger;
-%0Aimport org.HdrHistogram.Histogram;%0A%0Aimport java.util.concurrent.TimeUnit;
 %0A%0Aim
@@ -894,26 +894,24 @@
 g%5B%5D args) %7B%0A
-//
         Path
@@ -939,26 +939,24 @@
 thHandler()%0A
-//
             
@@ -1051,18 +1051,16 @@
 ader(),%0A
-//
         
@@ -1137,18 +1137,16 @@
 html%22))%0A
-//
         
@@ -1193,21 +1193,17 @@
 ard());%0A
-//%0A//
+%0A
         
@@ -1239,18 +1239,16 @@
 ilder()%0A
-//
         
@@ -1291,18 +1291,16 @@
 0.0.1%22)%0A
-//
         
@@ -1325,18 +1325,16 @@
 r(path)%0A
-//
         
@@ -1347,26 +1347,24 @@
   .build();%0A
-//
         serv
@@ -1379,13 +1379,9 @@
 ();%0A
-//%0A//
+%0A
     
@@ -1390,18 +1390,16 @@
   try %7B%0A
-//
         
@@ -1428,18 +1428,16 @@
 00000);%0A
-//
         
@@ -1471,18 +1471,16 @@
 on e) %7B%0A
-//
         
@@ -1504,18 +1504,16 @@
 race();%0A
-//
         
@@ -1514,18 +1514,16 @@
       %7D%0A
-//
         
@@ -1540,917 +1540,8 @@
 p();
-%0A%0A        Histogram histogram = new Histogram(1000, TimeUnit.HOURS.toNanos(1), 2);%0A        histogram.recordValue(2);%0A        histogram.recordValue(2);%0A        histogram.recordValue(2);%0A        histogram.recordValue(2);%0A        histogram.recordValue(2000);%0A        histogram.recordValue(3000);%0A        histogram.recordValue(5000);%0A        histogram.recordValue(TimeUnit.HOURS.toNanos(1));%0A%0A        System.out.println(histogram.getValueAtPercentile(50.0));%0A        System.out.println(histogram.getValueAtPercentile(90.0));%0A        System.out.println(histogram.getValueAtPercentile(99.0));%0A        System.out.println(histogram.getValueAtPercentile(99.9));%0A        System.out.println(histogram.getValueAtPercentile(99.99));%0A        System.out.println(histogram.getValueAtPercentile(99.999));%0A        System.out.println(histogram.getMaxValue());%0A%0A        histogram.outputPercentileDistribution(System.out, 1000.0);
 %0A   

Undo file change