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

时间:2018-01-31 12:12:33

标签: java jmeter formula performance-testing jmeter-plugins

我们正在开发支持在我们的应用程序中执行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);


    }
}

但是可以在公式Base中找到持续时间吗?

我实施了一个公式,但它没有像我预期的那样正常工作

enter image description here

示例Stepping ThreadGroup Value Images

IMAGE1:

enter image description here

图像2:enter image description here

0 个答案:

没有答案