计算 TP90TP99TP...


10s
1000s
100s
2s

Calculating TP is very simple:
- sort all times in ascending order: [2s, 10s, 100s, 1000s]
- find latest item in portion you need to calculate. For TP50 it will ceil(4.5)=2 requests. You need 2nd request. For TP90 it will be ceil(4.9)=4. You need 4th request.
- get time for the item found above. TP50=10s. TP90=1000s

private static int tp(List<Integer> times, int percent) {
        float percentF = (float)percent/100;
        int index = (int)(percentF * times.size() - 1);
        Collections.sort(times);
        return times.get(index);
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM