You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "songxiaosheng (via GitHub)" <gi...@apache.org> on 2023/08/09 09:51:41 UTC

[GitHub] [dubbo] songxiaosheng commented on pull request #12868: ⚡ use HdrHistogram to aggre

songxiaosheng commented on PR #12868:
URL: https://github.com/apache/dubbo/pull/12868#issuecomment-1671017155

   sample as follow:
   ```
   
   import org.HdrHistogram.ConcurrentDoubleHistogram;
   import org.HdrHistogram.ConcurrentHistogram;
   
   public class HistogramExample {
       public static void main(String[] args) {
           // 创建 ConcurrentHistogram 对象
           ConcurrentDoubleHistogram histogram = new ConcurrentDoubleHistogram(2);
           // 向直方图中添加数据
           histogram.recordValue(1);  // 假设添加了多个值
           histogram.recordValue(2);  // 假设添加了多个值
           histogram.recordValue(3);  // 假设添加了多个值
           histogram.recordValue(4);  // 假设添加了多个值
           histogram.recordValue(5);  // 假设添加了多个值
           histogram.recordValue(6);  // 假设添加了多个值
           histogram.recordValue(7);  // 假设添加了多个值
           histogram.recordValue(8);  // 假设添加了多个值
           histogram.recordValue(9);  // 假设添加了多个值
           histogram.recordValue(10);  // 假设添加了多个值
   
           double valueAtPercentile = histogram.getValueAtPercentile(80.0);
           System.out.println(valueAtPercentile);
       }
   }
   ```
   result is:
   `8.0546875`
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org