有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java在Jmeter中计算步进线程组执行的持续时间

我们正在开发一个在我们的应用程序中支持执行Jmx文件的工具 目前,我对基于Steping thread Group值获取执行持续时间存在问题

我使用Java获得了持续时间

 public class SteppingThreadGroup {

    public static void main(String[] args) {
        int TotalThreads = 500,
            firstWait   = 25,
            thenStart_threads = 5,
            nextAdd_threads    = 25,                        
            threadsEverySeconds = 30,
            usingRamupSeconds = 5,  
            holdForSeconds =600,
            finallyStopThreads =25,
            down_threadsEverySeconds =25,
            //extra varaibles
            RemaingThreads =0, Duration=0;
        float RampDown =0,rampupTime =0;;

        if(thenStart_threads>0){
            rampupTime =(firstWait+usingRamupSeconds+threadsEverySeconds);
            RemaingThreads =TotalThreads-thenStart_threads;
            System.out.format("Inital_Remaing_threads=%S,Inital_rampupTime=%f \n\n",RemaingThreads,rampupTime);
//          System.out.format(" ",rampupTime);
        }else{
            rampupTime = (firstWait);
            RemaingThreads=TotalThreads;
        }
        while(RemaingThreads >0){
            if(RemaingThreads>nextAdd_threads)
                rampupTime+= (Duration+usingRamupSeconds+threadsEverySeconds);
            else if(RemaingThreads==nextAdd_threads)
                rampupTime +=(Duration+usingRamupSeconds);
            else
                rampupTime +=(Duration+(RemaingThreads*(usingRamupSeconds/nextAdd_threads)));

            RemaingThreads=RemaingThreads-nextAdd_threads;

        }
        RampDown=((TotalThreads/finallyStopThreads-1)*down_threadsEverySeconds);
        Duration=(int) (holdForSeconds+rampupTime+RampDown);

        System.out.format("RamupTime =%S && HoldForSeconds =%S \n RamDown =%S && Total_Duration=%S", 
                            rampupTime,holdForSeconds,RampDown,Duration);


    }
}

但是有可能在公式库中找到持续时间吗

我实现了一个公式,但它并没有像我预期的那样工作良好

enter image description here

示例步进线程组值图像

图1:

enter image description here

图2:enter image description here


共 (0) 个答案