Add a new function to jmeter to shift date easily See : https://github.com/apache/jmeter/pull/291
Hi Maxime, I think your code can be committed now. Regards
I always hesitate to the implementation for the duration to add. Either I use the regex and implement our own format ( with months, days, minutes, seconds and even more like weeks etc..) or I use the Java 8 implementation with Duration object. I made a micro bench like this : Collection<CompoundVariable> params = makeParams("YYYY-MM-dd'T'HH:mm:ss", "", "P10DT-1H-5M5S", ""); long start = System.nanoTime(); for (int i = 0; i < 100_000; i++) { function.setParameters(params); value = function.execute(result, null); } long elapsed = System.nanoTime() - start; params = makeParams("YYYY-MM-dd'T'HH:mm:ss", "", "+10d-1H-5m5s", ""); start = System.nanoTime(); for (int i = 0; i < 100_000; i++) { function2.setParameters(params); value = function2.execute(result, null); } long elapsed2 = System.nanoTime() - start; System.out.println("Duration implementation : " + elapsed + " nanosecond"); System.out.println("Regex implementation : " + elapsed2 + " nanosecond"); With 100_000 calls result are : Duration implementation : 536599024 nanosecond Regex implementation : 283168954 nanosecond With 1_000_000 calls : Duration implementation : 1915462780 nanosecond Regex implementation : 1687908387 nanosecond With 10_000_000 calls : Duration implementation : 16609113426 nanosecond Regex implementation : 16680832427 nanosecond With 100_000_000 calls : Duration implementation : 150074506145 nanosecond Regex implementation : 164859380430 nanosecond So about 10_000_000 calls, the Duration implementation start to be better in performance. For me, I prefere the Regex implementation, which is more flexible and easy to understand for a user. What is your opinion?
>What is your opinion? Please use JMH for benchmarks. Thank you.
Close with commit r1794517 : http://svn.apache.org/viewvc?rev=1794517&view=rev
URL: http://svn.apache.org/viewvc?rev=1794517&view=rev Log: Add a time shifting function Bugzilla Id: 61040 Added: jmeter/trunk/licenses/bin/hamcrest-date-2.0.4.txt jmeter/trunk/src/functions/org/apache/jmeter/functions/TimeShift.java jmeter/trunk/test/src/org/apache/jmeter/functions/TestTimeShiftFunction.java Modified: jmeter/trunk/LICENSE jmeter/trunk/build.properties jmeter/trunk/build.xml jmeter/trunk/eclipse.classpath jmeter/trunk/res/maven/ApacheJMeter_parent.pom jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties jmeter/trunk/test/src/org/apache/jmeter/functions/FunctionTestHelper.java jmeter/trunk/xdocs/changes.xml jmeter/trunk/xdocs/usermanual/functions.xml
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/4377