修复Kperf测速工具仪表盘显示bug,优化Kperf缓存命中率

This commit is contained in:
2026-10-31 17:47:08 +08:00
parent c0e73bce55
commit ec51e5a778
6 changed files with 69 additions and 75 deletions
+4 -15
View File
@@ -77,11 +77,9 @@ public class Kperf implements Runnable{
KLALBPacket testPacket=null;
private KLALBPacket testPacket=null;
private long starttime=System.nanoTime();
long totaltime=1000;
long usedtime=0;
private ScheduledFuture<?> monitorUpdater;
@@ -121,9 +119,9 @@ public class Kperf implements Runnable{
});
Thread tc = ThreadTool.makeVDaemonThreadIfSupport("测速控制线程", () -> {
final int wtimes=5;
totaltime=(20*1000*1+20*1000*4+wtimes*1000*5)*1000000L;
starttime=System.nanoTime();
System.out.println("测速开始!");
if(reports!=null)
reports.updateDial(monitor);
try {
long startTime;
@@ -132,7 +130,6 @@ public class Kperf implements Runnable{
startTime=System.nanoTime();
for (int i = 0; i < 20; i++) {
Thread.sleep(1000);
updateUsedTime();
}
System.out.printf("上传延迟 最小:%.3fms 平均:%.3fms 抖动:%.3fms\n",monitor.getOutDelay()/1000000.0,monitor.getOutDelay()/1000000.0,monitor.getOutJitter()/1000000.0);
System.out.printf("下载延迟 最小:%.3fms 平均:%.3fms 抖动:%.3fms\n",monitor.getInDelay()/1000000.0,monitor.getInDelay()/1000000.0,monitor.getInJitter()/1000000.0);
@@ -298,9 +295,6 @@ public class Kperf implements Runnable{
tlock.unpark();
updateUsedTime() ;
if(reports!=null)
reports.updateDial(monitor);
break;
case KLALBPacket.TESTN:
break;
@@ -325,12 +319,7 @@ public class Kperf implements Runnable{
tcc.interrupt();
}
}
private void updateUsedTime() {
usedtime=System.nanoTime()-starttime;
//System.out.println(usedtime+" "+totaltime);
if(reports!=null)
reports.testProcess(usedtime/(double)totaltime);
}