View | Details | Raw Unified | Return to bug 60018
Collapse All | Expand All

(-)bin/jmeter.properties (+4 lines)
Lines 1242-1244 Link Here
1242
1242
1243
# Number of iterations to use to validate a Thread Group
1243
# Number of iterations to use to validate a Thread Group
1244
#testplan_validation.number_iterations=1
1244
#testplan_validation.number_iterations=1
1245
1246
# Timer factor that can be applied to Timer except for Constant ThroughputTimer and SynchronizingTimer
1247
# as long as any timer return false in  org.apache.jmeter.timers.Timer#isModifiable
1248
#timer.factor=1.0
(-)src/components/org/apache/jmeter/timers/BSFTimer.java (+5 lines)
Lines 52-55 Link Here
52
        }
52
        }
53
        return delay;
53
        return delay;
54
    }
54
    }
55
    
56
    @Override
57
    public boolean isModifiable() {
58
        return true;
59
    }
55
}
60
}
(-)src/components/org/apache/jmeter/timers/BeanShellTimer.java (+5 lines)
Lines 62-65 Link Here
62
            return 0;
62
            return 0;
63
        }
63
        }
64
    }
64
    }
65
66
    @Override
67
    public boolean isModifiable() {
68
        return true;
69
    }
65
}
70
}
(-)src/components/org/apache/jmeter/timers/ConstantThroughputTimer.java (-3 / +7 lines)
Lines 217-224 Link Here
217
        //Synchronize on the info object's MUTEX to ensure
217
        //Synchronize on the info object's MUTEX to ensure
218
        //Multiple threads don't update the scheduled time simultaneously
218
        //Multiple threads don't update the scheduled time simultaneously
219
        synchronized (info.MUTEX) {
219
        synchronized (info.MUTEX) {
220
            final long nextRequstTime = info.lastScheduledTime + milliSecPerRequest;
220
            final long nextRequestTime = info.lastScheduledTime + milliSecPerRequest;
221
            info.lastScheduledTime = Math.max(now, nextRequstTime);
221
            info.lastScheduledTime = Math.max(now, nextRequestTime);
222
            calculatedDelay = info.lastScheduledTime - now;
222
            calculatedDelay = info.lastScheduledTime - now;
223
        }
223
        }
224
224
Lines 329-333 Link Here
329
    void setMode(Mode newMode) {
329
    void setMode(Mode newMode) {
330
        mode = newMode;
330
        mode = newMode;
331
    }
331
    }
332
332
    
333
    @Override
334
    public boolean isModifiable() {
335
        return false;
336
    }
333
}
337
}
(-)src/components/org/apache/jmeter/timers/ConstantTimer.java (+5 lines)
Lines 109-112 Link Here
109
        delay = getPropertyAsLong(DELAY);
109
        delay = getPropertyAsLong(DELAY);
110
110
111
    }
111
    }
112
    
113
    @Override
114
    public boolean isModifiable() {
115
        return true;
116
    }
112
}
117
}
(-)src/components/org/apache/jmeter/timers/JSR223Timer.java (+5 lines)
Lines 50-53 Link Here
50
        }
50
        }
51
        return delay;
51
        return delay;
52
    }
52
    }
53
54
    @Override
55
    public boolean isModifiable() {
56
        return true;
57
    }
53
}
58
}
(-)src/components/org/apache/jmeter/timers/SyncTimer.java (+5 lines)
Lines 275-278 Link Here
275
    public void setTimeoutInMs(long timeoutInMs) {
275
    public void setTimeoutInMs(long timeoutInMs) {
276
        this.timeoutInMs = timeoutInMs;
276
        this.timeoutInMs = timeoutInMs;
277
    }
277
    }
278
279
    @Override
280
    public boolean isModifiable() {
281
        return false;
282
    }
278
}
283
}
(-)src/components/org/apache/jmeter/timers/UniformRandomTimer.java (-3 / +3 lines)
Lines 20-26 Link Here
20
20
21
import java.io.Serializable;
21
import java.io.Serializable;
22
22
23
import org.apache.jmeter.util.JMeterUtils;
23
import org.apache.commons.lang3.builder.ToStringBuilder;
24
24
25
/**
25
/**
26
 * This class implements those methods needed by RandomTimer to be instantiable
26
 * This class implements those methods needed by RandomTimer to be instantiable
Lines 38-44 Link Here
38
38
39
    @Override
39
    @Override
40
    public String toString() {
40
    public String toString() {
41
        return JMeterUtils.getResString("uniform_timer_memo"); //$NON-NLS-1$
41
        //return JMeterUtils.getResString("uniform_timer_memo"); //$NON-NLS-1$
42
        return ToStringBuilder.reflectionToString(this);
42
    }
43
    }
43
44
}
44
}
(-)src/core/org/apache/jmeter/threads/JMeterThread.java (-1 / +13 lines)
Lines 75-80 Link Here
75
    private static final int RAMPUP_GRANULARITY =
75
    private static final int RAMPUP_GRANULARITY =
76
            JMeterUtils.getPropDefault("jmeterthread.rampup.granularity", 1000); // $NON-NLS-1$
76
            JMeterUtils.getPropDefault("jmeterthread.rampup.granularity", 1000); // $NON-NLS-1$
77
77
78
    private static final double TIMER_FACTOR = JMeterUtils.getPropDefault("timer.factor", 1.0d);
79
78
    private final Controller threadGroupLoopController;
80
    private final Controller threadGroupLoopController;
79
81
80
    private final HashTree testTree;
82
    private final HashTree testTree;
Lines 795-801 Link Here
795
        long totalDelay = 0;
797
        long totalDelay = 0;
796
        for (Timer timer : timers) {
798
        for (Timer timer : timers) {
797
            TestBeanHelper.prepare((TestElement) timer);
799
            TestBeanHelper.prepare((TestElement) timer);
798
            totalDelay += timer.delay();
800
            long delay = timer.delay();
801
            if(TIMER_FACTOR != 1.0d && timer.isModifiable()) {
802
                if(log.isDebugEnabled()) {
803
                    log.debug("Applying TIMER_FACTOR:"
804
                            +TIMER_FACTOR + " on timer:"
805
                            +((TestElement)timer).getName()
806
                            + " for thread:"+getThreadName());
807
                }
808
                delay = Math.round(delay * TIMER_FACTOR);
809
            }
810
            totalDelay += delay;
799
        }
811
        }
800
        if (totalDelay > 0) {
812
        if (totalDelay > 0) {
801
            try {
813
            try {
(-)src/core/org/apache/jmeter/timers/Timer.java (+5 lines)
Lines 33-36 Link Here
33
     * @return the computed delay value.
33
     * @return the computed delay value.
34
     */
34
     */
35
    long delay();
35
    long delay();
36
37
    /**
38
     * @return true if factor can be applied to it
39
     */
40
    boolean isModifiable();
36
}
41
}
(-)src/core/org/apache/jmeter/util/JMeterUtils.java (+20 lines)
Lines 856-861 Link Here
856
        }
856
        }
857
        return ans;
857
        return ans;
858
    }
858
    }
859
    
860
    /**
861
     * Get a double value with default if not present.
862
     *
863
     * @param propName
864
     *            the name of the property.
865
     * @param defaultVal
866
     *            the default value.
867
     * @return The PropDefault value
868
     */
869
    public static double getPropDefault(String propName, double defaultVal) {
870
        double ans;
871
        try {
872
            ans = Double.parseDouble(appProperties.getProperty(propName, Double.toString(defaultVal)).trim());
873
        } catch (Exception e) {
874
            log.warn("Exception '"+ e.getMessage()+ "' occurred when fetching double property:'"+propName+"', defaulting to:"+defaultVal);
875
            ans = defaultVal;
876
        }
877
        return ans;
878
    }
859
879
860
    /**
880
    /**
861
     * Get a String value with default if not present.
881
     * Get a String value with default if not present.

Return to bug 60018