Compare commits

...

7 Commits

Author SHA1 Message Date
junyejiang 857f7390c9
Merge 71c084c2b8 into 83e211fed7 2025-07-08 02:55:00 +08:00
Milamber 83e211fed7
Move to Java 17 (migrate source code from Java 8) (#6462)
Validate Gradle Wrapper / Validation (push) Has been cancelled Details
CI / Matrix Preparation (push) Has been cancelled Details
CI / Error Prone (JDK 17) (push) Has been cancelled Details
Release Drafter / Update Release Draft (push) Has been cancelled Details
CI / ${{ matrix.name }} (push) Has been cancelled Details
* Prepare to use Java 17 as minimal version

* See #6219 Pattern Matching for instanceof uses (Java 14/16)

* See #6219 - Implicit Typing with var (Java 10)

* See #6219 - Using Switch Expressions / yield Keyword (Java 14)

* See #6219 - Using Text Blocks (Java 15)

* See #6219 - some tunning / formating style

* See #6219 - tunning code

* See #6219 - Update Java argline params / remove java 8 / 9 args/comments

* See #6219 - formating code

* Remove not standard options for Java 17

* See #6219 - refactor CompOper to an enum

* See #6219 - fix unnecessary yield usage in the switch expression

* See #6219 - Optimize the code, fix formatting issue
2025-07-07 09:43:25 +01:00
junyejiang 71c084c2b8
Merge branch 'apache:master' into ns 2025-03-05 17:39:22 +08:00
junyejiang fd12dc39aa update as CR 2025-03-05 17:38:27 +08:00
junyejiang b763de1974
Merge branch 'apache:master' into ns 2025-03-03 12:01:27 +08:00
junyejiang 173f05d333
Merge branch 'apache:master' into ns 2025-02-10 22:18:26 +08:00
Junye Jiang 4ba1600656 In my test experience, when the performance of the system under test is much too fast (for example, when testing Redis), the ms is too large to reflect the performance of the system under test, so the following changes are made:
1. Change the unit of Jmeter Result from ms to ns.
2. Statistical calculations use BigDecimal/BigInteger to make the statistical results more accurate and no overflow.
3. The test report uses ms/ns as the final output unit according to the Properties configuration.
2025-01-10 13:34:18 +08:00
95 changed files with 1237 additions and 733 deletions

View File

@ -115,18 +115,19 @@ if [ -z "$JAVA_HOME" ]; then
JAVA_HOME="$JRE_HOME"
fi
#--add-opens if JAVA 9
JAVA9_OPTS=
# Module access for modern Java versions (required for JMeter components)
JAVA_OPTS="--add-opens java.desktop/sun.awt=ALL-UNNAMED --add-opens java.desktop/sun.swing=ALL-UNNAMED --add-opens java.desktop/javax.swing.text.html=ALL-UNNAMED --add-opens java.desktop/java.awt=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/sun.awt.X11=ALL-UNNAMED --add-opens=java.desktop/sun.awt.shell=ALL-UNNAMED"
# Minimal version to run JMeter
MINIMAL_VERSION=8
MINIMAL_VERSION=17
# Check if version is from OpenJDK or Oracle Hotspot JVM prior to 9 containing 1.${version}.x
# Check if version meets the minimal requirement
CURRENT_VERSION=`"${JAVA_HOME}/bin/java" -version 2>&1 | awk -F'"' '/version/ {gsub("^1[.]", "", $2); gsub("[^0-9].*$", "", $2); print $2}'`
# Check if Java is present and the minimal version requirement
if [ "$CURRENT_VERSION" -gt "$MINIMAL_VERSION" ]; then
JAVA9_OPTS="--add-opens java.desktop/sun.awt=ALL-UNNAMED --add-opens java.desktop/sun.swing=ALL-UNNAMED --add-opens java.desktop/javax.swing.text.html=ALL-UNNAMED --add-opens java.desktop/java.awt=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/sun.awt.X11=ALL-UNNAMED --add-opens=java.desktop/sun.awt.shell=ALL-UNNAMED"
# Check if Java is present and meets the minimal version requirement
if [ "$CURRENT_VERSION" -lt "$MINIMAL_VERSION" ]; then
echo "ERROR: Java version $CURRENT_VERSION is too low. JMeter requires Java $MINIMAL_VERSION or higher."
exit 1
fi
: "${JMETER_OPTS:=""}"
@ -169,15 +170,19 @@ esac
# Default to en_EN
: "${JMETER_LANGUAGE:="-Duser.language=en -Duser.region=EN"}"
# Uncomment this to generate GC verbose file with Java prior to 9
# VERBOSE_GC="-verbose:gc -Xloggc:gc_jmeter_%p.log -XX:+PrintGCDetails -XX:+PrintGCCause -XX:+PrintTenuringDistribution -XX:+PrintHeapAtGC -XX:+PrintGCApplicationConcurrentTime -XX:+PrintAdaptiveSizePolicy -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCDateStamps"
# Legacy GC verbose options removed (Java 8/9 support discontinued)
# Uncomment this to generate GC verbose file with Java 9 and above
# VERBOSE_GC="-Xlog:gc*,gc+age=trace,gc+heap=debug:file=gc_jmeter_%p.log"
# Optimized GC logging for Java 17 with structured output and performance analysis
# Uncomment to enable comprehensive GC logging with rotation and detailed metrics
# VERBOSE_GC="-Xlog:gc,gc+heap,gc+regions,gc+refine,gc+phases:gc_jmeter_%p_%t.log:time,level,tags:filecount=5,filesize=50M"
# Alternative: Minimal GC logging for production (uncomment if needed)
# VERBOSE_GC="-Xlog:gc:gc_jmeter_%p.log:time"
# Docker support for Java 17+
# Modern container memory detection is automatic in Java 17+
# RUN_IN_DOCKER="-XX:+UseContainerSupport"
# Uncomment this if you run JMeter in DOCKER (need Java SE 8u131 or JDK 9)
# see https://blogs.oracle.com/java-platform-group/java-se-support-for-docker-cpu-and-memory-limits
# RUN_IN_DOCKER="-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"
# Finally, some tracing to help in case things go astray:
# You may want to add those settings:
@ -191,7 +196,7 @@ SYSTEM_PROPS="-Djava.security.egd=file:/dev/urandom"
SERVER="-server"
if [ -z "${JMETER_COMPLETE_ARGS}" ]; then
ARGS="$JAVA9_OPTS $SERVER $DUMP $HEAP $VERBOSE_GC $GC_ALGO $SYSTEM_PROPS $JMETER_LANGUAGE $RUN_IN_DOCKER"
ARGS="$JAVA_OPTS $SERVER $DUMP $HEAP $VERBOSE_GC $GC_ALGO $SYSTEM_PROPS $JMETER_LANGUAGE $RUN_IN_DOCKER"
else
ARGS=""
fi

View File

@ -78,12 +78,19 @@ if not defined JMETER_LANGUAGE (
)
rem Minimal version to run JMeter
set MINIMAL_VERSION=1.8.0
set MINIMAL_VERSION=17.0.0
rem --add-opens if JAVA 9
set JAVA9_OPTS=
rem Optimized GC logging for Java 17 with structured output and performance analysis
rem Uncomment to enable comprehensive GC logging with rotation and detailed metrics
rem set VERBOSE_GC=-Xlog:gc,gc+heap,gc+regions,gc+refine,gc+phases:gc_jmeter_%%p_%%t.log:time,level,tags:filecount=5,filesize=50M
rem Alternative: Minimal GC logging for production (uncomment if needed)
rem set VERBOSE_GC=-Xlog:gc:gc_jmeter_%%p.log:time
rem Module access for modern Java versions (required for JMeter components)
set JAVA_OPTS=--add-opens java.desktop/sun.awt=ALL-UNNAMED --add-opens java.desktop/sun.swing=ALL-UNNAMED --add-opens java.desktop/javax.swing.text.html=ALL-UNNAMED --add-opens java.desktop/java.awt=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/sun.awt.shell=ALL-UNNAMED
for /f "tokens=3" %%g in ('java -version 2^>^&1 ^| findstr /i "version"') do (
rem @echo Debug Output: %%g
@ -95,36 +102,24 @@ if not defined JAVAVER (
goto pause
)
rem Check if version is from OpenJDK or Oracle Hotspot JVM prior to 9 containing 1.${version}.x
rem JAVAVER will be equal to "9.0.4" (quotes are part of the value) for Oracle Java 9
rem JAVAVER will be equal to "1.8.0_161" (quotes are part of the value) for Oracle Java 8
rem so we extract 2 chars starting from index 1
IF "%JAVAVER:~1,2%"=="1." (
set JAVAVER=%JAVAVER:"=%
for /f "delims=. tokens=1-3" %%v in ("%JAVAVER%") do (
set current_minor=%%w
)
) else (
rem Java 9 at least
set current_minor=9
set JAVA9_OPTS=--add-opens java.desktop/sun.awt=ALL-UNNAMED --add-opens java.desktop/sun.swing=ALL-UNNAMED --add-opens java.desktop/javax.swing.text.html=ALL-UNNAMED --add-opens java.desktop/java.awt=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/sun.awt.shell=ALL-UNNAMED
rem Extract major version number from Java version string
for /f "delims=. tokens=1" %%v in ("%JAVAVER:~1,-1%") do (
set current_major=%%v
)
for /f "delims=. tokens=1-3" %%v in ("%MINIMAL_VERSION%") do (
set minimal_minor=%%w
rem Extract minimal major version
for /f "delims=. tokens=1" %%v in ("%MINIMAL_VERSION%") do (
set minimal_major=%%v
)
if not defined current_minor (
if not defined current_major (
@echo Not able to find Java executable or version. Please check your Java installation.
set ERRORLEVEL=2
goto pause
)
rem @echo Debug: CURRENT=%current_minor% - MINIMAL=%minimal_minor%
if %current_minor% LSS %minimal_minor% (
@echo Error: Java version -- %JAVAVER% -- is too low to run JMeter. Needs a Java version greater than or equal to %MINIMAL_VERSION%
if %current_major% LSS %minimal_major% (
@echo Error: Java version -- %JAVAVER% -- is too low to run JMeter. Needs Java %MINIMAL_VERSION% or higher.
set ERRORLEVEL=3
goto pause
)
@ -151,13 +146,7 @@ if not defined HEAP (
set HEAP=-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m
)
rem Uncomment this to generate GC verbose file with Java prior to 9
rem set VERBOSE_GC=-verbose:gc -Xloggc:gc_jmeter_%%p.log -XX:+PrintGCDetails -XX:+PrintGCCause -XX:+PrintTenuringDistribution -XX:+PrintHeapAtGC -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCDateStamps -XX:+PrintAdaptiveSizePolicy
rem Uncomment this to generate GC verbose file with Java 9 and above
rem set VERBOSE_GC=-Xlog:gc*,gc+age=trace,gc+heap=debug:file=gc_jmeter_%%p.log
rem You may want to add those settings
rem -XX:+ParallelRefProcEnabled -XX:+PerfDisableSharedMem
rem Legacy GC verbose options removed (Java 8/9 support discontinued)
if not defined GC_ALGO (
set GC_ALGO=-XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:G1ReservePercent=20
)
@ -167,9 +156,9 @@ set SYSTEM_PROPS=-Djava.security.egd=file:/dev/urandom
rem Always dump on OOM (does not cost anything unless triggered)
set DUMP=-XX:+HeapDumpOnOutOfMemoryError
rem Uncomment this if you run JMeter in DOCKER (need Java SE 8u131 or JDK 9)
rem see https://blogs.oracle.com/java-platform-group/java-se-support-for-docker-cpu-and-memory-limits
rem set RUN_IN_DOCKER=-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap
rem Docker support for Java 17+
rem Modern container memory detection is automatic in Java 17+
rem set RUN_IN_DOCKER=-XX:+UseContainerSupport
rem Additional settings that might help improve GUI performance on some platforms
rem See: http://www.oracle.com/technetwork/java/perf-graphics-135933.html
@ -188,7 +177,7 @@ if not defined DDRAW (
rem Collect the settings defined above
if not defined JMETER_COMPLETE_ARGS (
set ARGS=%JAVA9_OPTS% %DUMP% %HEAP% %VERBOSE_GC% %GC_ALGO% %DDRAW% %SYSTEM_PROPS% %JMETER_LANGUAGE% %RUN_IN_DOCKER%
set ARGS=%JAVA_OPTS% %DUMP% %HEAP% %VERBOSE_GC% %GC_ALGO% %DDRAW% %SYSTEM_PROPS% %JMETER_LANGUAGE% %RUN_IN_DOCKER%
) else (
set ARGS=
)

View File

@ -90,14 +90,17 @@ fi
JAVA9_OPTS=
# Minimal version to run JMeter
MINIMAL_VERSION=8
MINIMAL_VERSION=17
# Check if version is from OpenJDK or Oracle Hotspot JVM prior to 9 containing 1.${version}.x
CURRENT_VERSION=`"${JAVA_HOME}/bin/java" -version 2>&1 | awk -F'"' '/version/ {gsub("^1[.]", "", $2); gsub("[^0-9].*$", "", $2); print $2}'`
# Check if Java is present and the minimal version requirement
if [ "$CURRENT_VERSION" -gt "$MINIMAL_VERSION" ]; then
if [ "$CURRENT_VERSION" -ge "$MINIMAL_VERSION" ]; then
JAVA9_OPTS="--add-opens java.desktop/sun.awt=ALL-UNNAMED --add-opens java.desktop/sun.swing=ALL-UNNAMED --add-opens java.desktop/javax.swing.text.html=ALL-UNNAMED --add-opens java.desktop/java.awt=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/sun.awt.X11=ALL-UNNAMED --add-opens=java.desktop/sun.awt.shell=ALL-UNNAMED"
else
echo "JMeter requires Java $MINIMAL_VERSION or later. Current Java version is $CURRENT_VERSION"
exit 1
fi
# Don't add additional arguments to the JVM start, except those needed for Java 9

View File

@ -41,7 +41,7 @@ function summaryTableHeader(header) {
cell = document.createElement('th');
cell.setAttribute("data-sorter", false);
cell.colSpan = 7;
cell.innerHTML = "Response Times (ms)";
cell.innerHTML = "Response Times (${jmeter_reportgenerator_ms_ns})";
newRow.appendChild(cell);
cell = document.createElement('th');

View File

@ -58,7 +58,7 @@ var responseTimePercentilesInfos = {
axisLabelPadding: 20,
},
yaxis: {
axisLabel: "Percentile value in ms",
axisLabel: "Percentile value in ${jmeter_reportgenerator_ms_ns}",
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 12,
axisLabelFontFamily: 'Verdana, Arial',
@ -70,7 +70,7 @@ var responseTimePercentilesInfos = {
},
tooltip: true,
tooltipOpts: {
content: "%s : %x.2 percentile was %y ms"
content: "%s : %x.2 percentile was %y ${jmeter_reportgenerator_ms_ns}"
},
selection: { mode: "xy" },
};
@ -127,7 +127,7 @@ var responseTimeDistributionInfos = {
container: '#legendResponseTimeDistribution'
},
xaxis:{
axisLabel: "Response times in ms",
axisLabel: "Response times in ${jmeter_reportgenerator_ms_ns}",
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 12,
axisLabelFontFamily: 'Verdana, Arial',
@ -151,7 +151,7 @@ var responseTimeDistributionInfos = {
tooltip: true,
tooltipOpts: {
content: function(label, xval, yval, flotItem){
return yval + " responses for " + label + " were between " + xval + " and " + (xval + granularity) + " ms";
return yval + " responses for " + label + " were between " + xval + " and " + (xval + granularity) + " ${jmeter_reportgenerator_ms_ns}";
}
}
};
@ -355,7 +355,7 @@ var timeVsThreadsInfos = {
axisLabelPadding: 20,
},
yaxis: {
axisLabel: "Average response times in ms",
axisLabel: "Average response times in ${jmeter_reportgenerator_ms_ns}",
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 12,
axisLabelFontFamily: 'Verdana, Arial',
@ -370,7 +370,7 @@ var timeVsThreadsInfos = {
},
tooltip: true,
tooltipOpts: {
content: "%s: At %x.2 active threads, Average response time was %y.2 ms"
content: "%s: At %x.2 active threads, Average response time was %y.2 ${jmeter_reportgenerator_ms_ns}"
}
};
},
@ -505,7 +505,7 @@ var responseTimesOverTimeInfos = {
axisLabelPadding: 20,
},
yaxis: {
axisLabel: "Average response time in ms",
axisLabel: "Average response time in ${jmeter_reportgenerator_ms_ns}",
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 12,
axisLabelFontFamily: 'Verdana, Arial',
@ -525,7 +525,7 @@ var responseTimesOverTimeInfos = {
},
tooltip: true,
tooltipOpts: {
content: "%s : at %x Average response time was %y ms"
content: "%s : at %x Average response time was %y ${jmeter_reportgenerator_ms_ns}"
}
};
},
@ -586,7 +586,7 @@ var latenciesOverTimeInfos = {
axisLabelPadding: 20,
},
yaxis: {
axisLabel: "Average response latencies in ms",
axisLabel: "Average response latencies in ${jmeter_reportgenerator_ms_ns}",
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 12,
axisLabelFontFamily: 'Verdana, Arial',
@ -606,7 +606,7 @@ var latenciesOverTimeInfos = {
},
tooltip: true,
tooltipOpts: {
content: "%s : at %x Average latency was %y ms"
content: "%s : at %x Average latency was %y ${jmeter_reportgenerator_ms_ns}"
}
};
},
@ -667,7 +667,7 @@ var connectTimeOverTimeInfos = {
axisLabelPadding: 20,
},
yaxis: {
axisLabel: "Average Connect Time in ms",
axisLabel: "Average Connect Time in ${jmeter_reportgenerator_ms_ns}",
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 12,
axisLabelFontFamily: 'Verdana, Arial',
@ -687,7 +687,7 @@ var connectTimeOverTimeInfos = {
},
tooltip: true,
tooltipOpts: {
content: "%s : at %x Average connect time was %y ms"
content: "%s : at %x Average connect time was %y ${jmeter_reportgenerator_ms_ns}"
}
};
},
@ -749,7 +749,7 @@ var responseTimePercentilesOverTimeInfos = {
axisLabelPadding: 20,
},
yaxis: {
axisLabel: "Response Time in ms",
axisLabel: "Response Time in ${jmeter_reportgenerator_ms_ns}",
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 12,
axisLabelFontFamily: 'Verdana, Arial',
@ -769,7 +769,7 @@ var responseTimePercentilesOverTimeInfos = {
},
tooltip: true,
tooltipOpts: {
content: "%s : at %x Response time was %y ms"
content: "%s : at %x Response time was %y ${jmeter_reportgenerator_ms_ns}"
}
};
},
@ -825,7 +825,7 @@ var responseTimeVsRequestInfos = {
axisLabelPadding: 20,
},
yaxis: {
axisLabel: "Median Response Time in ms",
axisLabel: "Median Response Time in ${jmeter_reportgenerator_ms_ns}",
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 12,
axisLabelFontFamily: 'Verdana, Arial',
@ -844,7 +844,7 @@ var responseTimeVsRequestInfos = {
},
tooltip: true,
tooltipOpts: {
content: "%s : Median response time at %x req/s was %y ms"
content: "%s : Median response time at %x req/s was %y ${jmeter_reportgenerator_ms_ns}"
},
colors: ["#9ACD32", "#FF6347"]
};
@ -899,7 +899,7 @@ var latenciesVsRequestInfos = {
axisLabelPadding: 20,
},
yaxis: {
axisLabel: "Median Latency in ms",
axisLabel: "Median Latency in ${jmeter_reportgenerator_ms_ns}",
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 12,
axisLabelFontFamily: 'Verdana, Arial',
@ -914,7 +914,7 @@ var latenciesVsRequestInfos = {
},
tooltip: true,
tooltipOpts: {
content: "%s : Median Latency time at %x req/s was %y ms"
content: "%s : Median Latency time at %x req/s was %y ${jmeter_reportgenerator_ms_ns}"
},
colors: ["#9ACD32", "#FF6347"]
};
@ -1413,4 +1413,3 @@ function toggleAll(id, checked){
});
}
}

View File

@ -34,6 +34,9 @@
# Reporting configuration
#---------------------------------------------------------------------------
#The time unit in reports and visualizers: ms(millisecond) / ns(nanosecond)
jmeter.reportgenerator.ms_ns=ms
# Sets the satisfaction threshold for the APDEX calculation (in milliseconds).
#jmeter.reportgenerator.apdex_satisfied_threshold=500

50
bin/testfiles/ns.json Normal file
View File

@ -0,0 +1,50 @@
{
"JR-KO" : {
"transaction" : "JR-KO",
"sampleCount" : 3,
"errorCount" : 3,
"errorPct" : 100.0,
"meanResTime" : 1.9966666666666666E8,
"medianResTime" : 1.7E8,
"minResTime" : 1.0E8,
"maxResTime" : 3.29E8,
"pct1ResTime" : 3.29E8,
"pct2ResTime" : 3.29E8,
"pct3ResTime" : 3.29E8,
"throughput" : 0.07922465471254654,
"receivedKBytesPerSec" : 0.0015473565373544248,
"sentKBytesPerSec" : 6.1894261494177E-4
},
"Total" : {
"transaction" : "Total",
"sampleCount" : 255,
"errorCount" : 3,
"errorPct" : 1.1764706,
"meanResTime" : 2.354745098039215E8,
"medianResTime" : 2.32E8,
"minResTime" : 1.0E8,
"maxResTime" : 3.53E8,
"pct1ResTime" : 3.37E8,
"pct2ResTime" : 3.392E8,
"pct3ResTime" : 3.53E8,
"throughput" : 4.2369361136495804,
"receivedKBytesPerSec" : 0.07457474869153444,
"sentKBytesPerSec" : 0.03310106338788735
},
"JR-OK" : {
"transaction" : "JR-OK",
"sampleCount" : 252,
"errorCount" : 0,
"errorPct" : 0.0,
"meanResTime" : 2.359007936507938E8,
"medianResTime" : 2.32E8,
"minResTime" : 1.01E8,
"maxResTime" : 3.53E8,
"pct1ResTime" : 3.37E8,
"pct2ResTime" : 3.3935E8,
"pct3ResTime" : 3.53E8,
"throughput" : 4.187089806430174,
"receivedKBytesPerSec" : 0.0736011880036554,
"sentKBytesPerSec" : 0.03271163911273573
}
}

256
bin/testfiles/ns.jtl Normal file
View File

@ -0,0 +1,256 @@
timeStamp,timeStamp_ns,elapsed,elapsed_ns,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,Latency_ns,IdleTime,IdleTime_ns,Connect,Connect_ns
0,1551783627191000000,1,351000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783627543000000,1,192000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783627735000000,1,131000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783627866000000,1,261000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783628128000000,1,266000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783628395000000,1,279000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783628674000000,1,304000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783628979000000,1,353000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783629333000000,1,196000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783629530000000,1,139000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783629670000000,1,278000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783629949000000,1,303000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783630253000000,1,351000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783630605000000,1,194000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783630799000000,1,134000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783630934000000,1,268000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783631202000000,1,282000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783631485000000,1,308000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783631794000000,1,108000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783631903000000,1,217000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783632120000000,1,180000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783632301000000,1,107000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783632408000000,1,213000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783632622000000,1,171000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783632794000000,1,342000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783633137000000,1,176000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783633313000000,1,353000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783633666000000,1,196000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783633863000000,1,137000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783634001000000,1,275000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783634276000000,1,296000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783634573000000,1,336000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783634910000000,1,164000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783635075000000,1,328000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783635404000000,1,148000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783635552000000,1,297000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783635850000000,1,338000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783636189000000,1,168000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783636357000000,1,337000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783636695000000,1,164000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783636859000000,1,329000000,JR-KO,400,Bad request,Thread Group 1-1,text,FALSE,,20,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783637189000000,1,147000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783637337000000,1,296000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783637634000000,1,339000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783637974000000,1,168000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783638142000000,1,337000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783638480000000,1,164000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783638644000000,1,329000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783638974000000,1,148000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783639122000000,1,297000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783639420000000,1,338000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783639759000000,1,168000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783639927000000,1,337000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783640264000000,1,164000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783640429000000,1,329000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783640758000000,1,148000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783640907000000,1,295000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783641203000000,1,336000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783641540000000,1,164000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783641705000000,1,328000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783642034000000,1,148000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783642182000000,1,297000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783642480000000,1,339000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783642819000000,1,169000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783642989000000,1,338000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783643327000000,1,166000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783643493000000,1,333000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783643827000000,1,156000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783643983000000,1,313000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783644297000000,1,116000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783644413000000,1,233000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783644647000000,1,211000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783644858000000,1,168000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783645027000000,1,336000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783645363000000,1,163000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783645527000000,1,325000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783645853000000,1,142000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783645995000000,1,285000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783646280000000,1,315000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783646596000000,1,120000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783646717000000,1,241000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783646958000000,1,227000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783647186000000,1,200000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783647386000000,1,146000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783647533000000,1,292000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783647826000000,1,331000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783648157000000,1,152000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783648310000000,1,304000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783648615000000,1,353000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783648968000000,1,199000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783649167000000,1,142000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783649310000000,1,284000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783649594000000,1,314000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783649909000000,1,118000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783650027000000,1,238000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783650265000000,1,220000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783650486000000,1,185000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783650671000000,1,116000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783650788000000,1,232000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783651021000000,1,210000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783651231000000,1,166000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783651398000000,1,332000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783651730000000,1,155000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783651886000000,1,309000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783652196000000,1,110000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783652307000000,1,221000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783652528000000,1,187000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783652715000000,1,121000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783652836000000,1,241000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783653078000000,1,227000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783653306000000,1,200000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783653506000000,1,146000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783653653000000,1,292000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783653945000000,1,330000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783654275000000,1,150000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783654425000000,1,300000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783654726000000,1,344000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783655071000000,1,180000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783655251000000,1,106000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783655358000000,1,212000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783655571000000,1,170000000,JR-KO,400,Bad request,Thread Group 1-1,text,FALSE,,20,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783655741000000,1,340000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783656081000000,1,171000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783656253000000,1,342000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783656595000000,1,174000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783656770000000,1,348000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783657118000000,1,189000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783657307000000,1,123000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783657430000000,1,245000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783657675000000,1,235000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783657911000000,1,215000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783658126000000,1,176000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783658303000000,1,352000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783658656000000,1,195000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783658852000000,1,136000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783658989000000,1,272000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783659262000000,1,291000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783659553000000,1,327000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783659880000000,1,145000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783660025000000,1,290000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783660316000000,1,324000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783660641000000,1,140000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783660782000000,1,281000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783661063000000,1,307000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783661370000000,1,105000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783661476000000,1,210000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783661687000000,1,166000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783661853000000,1,333000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783662186000000,1,157000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783662343000000,1,313000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783662657000000,1,116000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783662774000000,1,232000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783663007000000,1,211000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783663219000000,1,168000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783663387000000,1,337000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783663725000000,1,164000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783663889000000,1,329000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783664218000000,1,149000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783664367000000,1,297000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783664664000000,1,339000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783665004000000,1,168000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783665172000000,1,337000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783665510000000,1,164000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783665675000000,1,328000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783666004000000,1,148000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783666152000000,1,297000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783666450000000,1,339000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783666789000000,1,168000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783666958000000,1,336000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783667295000000,1,164000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783667460000000,1,328000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783667789000000,1,148000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783667937000000,1,297000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783668234000000,1,339000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783668574000000,1,168000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783668742000000,1,337000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783669079000000,1,164000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783669244000000,1,328000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783669573000000,1,147000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783669720000000,1,295000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783670015000000,1,335000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783670351000000,1,162000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783670513000000,1,324000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783670837000000,1,137000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783670975000000,1,274000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783671249000000,1,294000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783671544000000,1,333000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783671877000000,1,157000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783672035000000,1,314000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783672349000000,1,118000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783672468000000,1,237000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783672705000000,1,220000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783672926000000,1,185000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783673111000000,1,116000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783673228000000,1,232000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783673460000000,1,210000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783673671000000,1,165000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783673836000000,1,331000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783674167000000,1,153000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783674320000000,1,305000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783674626000000,1,100000000,JR-KO,400,Bad request,Thread Group 1-1,text,FALSE,,20,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783674727000000,1,201000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783674928000000,1,149000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783675077000000,1,297000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783675374000000,1,339000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783675714000000,1,168000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783675882000000,1,337000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783676219000000,1,164000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783676384000000,1,327000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783676712000000,1,146000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783676859000000,1,292000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783677152000000,1,331000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783677484000000,1,153000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783677638000000,1,306000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783677945000000,1,104000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783678050000000,1,208000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783678259000000,1,163000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783678422000000,1,327000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783678750000000,1,144000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783678894000000,1,289000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783679183000000,1,323000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783679507000000,1,135000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783679643000000,1,272000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783679915000000,1,290000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783680205000000,1,325000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783680530000000,1,141000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783680671000000,1,281000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783680952000000,1,307000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783681260000000,1,104000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783681365000000,1,208000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783681574000000,1,163000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783681738000000,1,326000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783682065000000,1,144000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783682209000000,1,289000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783682499000000,1,323000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783682822000000,1,137000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783682960000000,1,274000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783683234000000,1,293000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783683527000000,1,332000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783683859000000,1,155000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783684014000000,1,309000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783684323000000,1,108000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783684432000000,1,216000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783684648000000,1,178000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783684827000000,1,101000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783684928000000,1,203000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783685132000000,1,151000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783685283000000,1,303000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783685587000000,1,350000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783685938000000,1,192000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783686130000000,1,131000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783686261000000,1,261000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783686523000000,1,267000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783686790000000,1,280000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000
0,1551783687071000000,1,305000000,JR-OK,200,Good request,Thread Group 1-1,text,TRUE,,18,8,1,1,null,0,2000000,0,3000000,0,4000000

View File

@ -0,0 +1 @@
jmeter.reportgenerator.ms_ns=ns

View File

@ -121,18 +121,14 @@ tasks.configureEach<Javadoc> {
docTitle = "Apache JMeter ${project.name} API"
windowTitle = "Apache JMeter ${project.name} API"
header = "<b>Apache JMeter</b>"
addStringOption("source", "8")
addStringOption("source", "17")
addStringOption("Xmaxwarns", "10")
addBooleanOption("Xdoclint:all,-missing", true)
val lastEditYear: String by rootProject.extra
bottom =
"Copyright &copy; 1998-$lastEditYear Apache Software Foundation. All Rights Reserved."
if (buildParameters.buildJdkVersion > 8) {
addBooleanOption("html5", true)
links("https://docs.oracle.com/en/java/javase/11/docs/api/")
} else {
links("https://docs.oracle.com/javase/8/docs/api/")
}
addBooleanOption("html5", true)
links("https://docs.oracle.com/en/java/javase/17/docs/api/")
}
}

View File

@ -77,7 +77,7 @@ public class CompareAssertion extends AbstractTestElement implements Assertion,
for (SampleResult currentResult : responses) {
long currentTime = currentResult.getTime();
if (prevTime != -1) {
boolean failure = Math.abs(prevTime - currentTime) > compareTime;
boolean failure = Math.abs(prevTime - currentTime) > compareTime * 1000000L;
if (failure) {
markTimeFailure(result, prevResult, prevTime, currentResult, currentTime);
return;

View File

@ -49,7 +49,7 @@ public class DurationAssertion extends AbstractScopedAssertion implements Serial
if (duration > 0) {
long responseTime=response.getTime();
// has the Sample lasted too long?
if ( responseTime > duration ) {
if ( responseTime > duration * 1000000L ) {
result.setFailure(true);
Object[] arguments = {responseTime, duration};
String message = MessageFormat.format(

View File

@ -35,17 +35,86 @@ public class SizeAssertion extends AbstractScopedAssertion implements Serializab
private static final long serialVersionUID = 241L;
// Static int to signify the type of logical comparator to assert
/**
* Comparison operators for size assertions
*/
public enum ComparisonOperator {
EQUAL(1, "size_assertion_comparator_error_equal"),
NOTEQUAL(2, "size_assertion_comparator_error_notequal"),
GREATERTHAN(3, "size_assertion_comparator_error_greater"),
LESSTHAN(4, "size_assertion_comparator_error_less"),
GREATERTHANEQUAL(5, "size_assertion_comparator_error_greaterequal"),
LESSTHANEQUAL(6, "size_assertion_comparator_error_lessequal");
private static final ComparisonOperator[] VALUES = values();
private final int value;
private final String errorMessageKey;
ComparisonOperator(int value, String errorMessageKey) {
this.value = value;
this.errorMessageKey = errorMessageKey;
}
public int getValue() {
return value;
}
public String getErrorMessageKey() {
return errorMessageKey;
}
public static ComparisonOperator fromValue(int value) {
for (ComparisonOperator op : VALUES) {
if (op.value == value) {
return op;
}
}
return null;
}
public boolean evaluate(long actual, long expected) {
switch (this) {
case EQUAL:
return actual == expected;
case NOTEQUAL:
return actual != expected;
case GREATERTHAN:
return actual > expected;
case LESSTHAN:
return actual < expected;
case GREATERTHANEQUAL:
return actual >= expected;
case LESSTHANEQUAL:
return actual <= expected;
}
throw new IllegalStateException("Unexpected value: " + this);
}
}
// Backward compatibility constants - deprecated
/** @deprecated Use {@link ComparisonOperator#EQUAL} instead */
@Deprecated
public static final int EQUAL = 1;
/** @deprecated Use {@link ComparisonOperator#NOTEQUAL} instead */
@Deprecated
public static final int NOTEQUAL = 2;
/** @deprecated Use {@link ComparisonOperator#GREATERTHAN} instead */
@Deprecated
public static final int GREATERTHAN = 3;
/** @deprecated Use {@link ComparisonOperator#LESSTHAN} instead */
@Deprecated
public static final int LESSTHAN = 4;
/** @deprecated Use {@link ComparisonOperator#GREATERTHANEQUAL} instead */
@Deprecated
public static final int GREATERTHANEQUAL = 5;
/** @deprecated Use {@link ComparisonOperator#LESSTHANEQUAL} instead */
@Deprecated
public static final int LESSTHANEQUAL = 6;
/** Key for storing assertion-information in the jmx-file. */
@ -175,41 +244,17 @@ public class SizeAssertion extends AbstractScopedAssertion implements Serializab
*
*/
private String compareSize(long resultSize) {
String comparatorErrorMessage;
long allowedSize = Long.parseLong(getAllowedSize());
boolean result;
int comp = getCompOper();
switch (comp) {
case EQUAL:
result = resultSize == allowedSize;
comparatorErrorMessage = JMeterUtils.getResString("size_assertion_comparator_error_equal"); //$NON-NLS-1$
break;
case NOTEQUAL:
result = resultSize != allowedSize;
comparatorErrorMessage = JMeterUtils.getResString("size_assertion_comparator_error_notequal"); //$NON-NLS-1$
break;
case GREATERTHAN:
result = resultSize > allowedSize;
comparatorErrorMessage = JMeterUtils.getResString("size_assertion_comparator_error_greater"); //$NON-NLS-1$
break;
case LESSTHAN:
result = resultSize < allowedSize;
comparatorErrorMessage = JMeterUtils.getResString("size_assertion_comparator_error_less"); //$NON-NLS-1$
break;
case GREATERTHANEQUAL:
result = resultSize >= allowedSize;
comparatorErrorMessage = JMeterUtils.getResString("size_assertion_comparator_error_greaterequal"); //$NON-NLS-1$
break;
case LESSTHANEQUAL:
result = resultSize <= allowedSize;
comparatorErrorMessage = JMeterUtils.getResString("size_assertion_comparator_error_lessequal"); //$NON-NLS-1$
break;
default:
result = false;
comparatorErrorMessage = "ERROR - invalid condition";
break;
ComparisonOperator operator = ComparisonOperator.fromValue(getCompOper());
if (operator == null) {
return "ERROR - invalid condition";
}
if (operator.evaluate(resultSize, allowedSize)) {
return "";
} else {
return JMeterUtils.getResString(operator.getErrorMessageKey());
}
return result ? "" : comparatorErrorMessage;
}
private void setTestField(String testField) {

View File

@ -135,7 +135,7 @@ public class SizeAssertionGui extends AbstractAssertionGui implements ActionList
lessthanButton.setSelected(false);
greaterthanequalButton.setSelected(false);
lessthanequalButton.setSelected(false);
execState = SizeAssertion.EQUAL;
execState = SizeAssertion.ComparisonOperator.EQUAL.getValue();
}
@Override
@ -164,32 +164,32 @@ public class SizeAssertionGui extends AbstractAssertionGui implements ActionList
* <p>
* Allowed states are
* <ul>
* <li>{@link SizeAssertion#EQUAL}</li>
* <li>{@link SizeAssertion#NOTEQUAL}</li>
* <li>{@link SizeAssertion#GREATERTHAN}</li>
* <li>{@link SizeAssertion#LESSTHAN}</li>
* <li>{@link SizeAssertion#GREATERTHANEQUAL}</li>
* <li>{@link SizeAssertion#LESSTHANEQUAL}</li>
* <li>{@link SizeAssertion.ComparisonOperator#EQUAL}</li>
* <li>{@link SizeAssertion.ComparisonOperator#NOTEQUAL}</li>
* <li>{@link SizeAssertion.ComparisonOperator#GREATERTHAN}</li>
* <li>{@link SizeAssertion.ComparisonOperator#LESSTHAN}</li>
* <li>{@link SizeAssertion.ComparisonOperator#GREATERTHANEQUAL}</li>
* <li>{@link SizeAssertion.ComparisonOperator#LESSTHANEQUAL}</li>
* </ul>
* @param state One of the allowed states
*/
public void setState(int state) {
if (state == SizeAssertion.EQUAL) {
if (state == SizeAssertion.ComparisonOperator.EQUAL.getValue()) {
equalButton.setSelected(true);
execState = state;
} else if (state == SizeAssertion.NOTEQUAL) {
} else if (state == SizeAssertion.ComparisonOperator.NOTEQUAL.getValue()) {
notequalButton.setSelected(true);
execState = state;
} else if (state == SizeAssertion.GREATERTHAN) {
} else if (state == SizeAssertion.ComparisonOperator.GREATERTHAN.getValue()) {
greaterthanButton.setSelected(true);
execState = state;
} else if (state == SizeAssertion.LESSTHAN) {
} else if (state == SizeAssertion.ComparisonOperator.LESSTHAN.getValue()) {
lessthanButton.setSelected(true);
execState = state;
} else if (state == SizeAssertion.GREATERTHANEQUAL) {
} else if (state == SizeAssertion.ComparisonOperator.GREATERTHANEQUAL.getValue()) {
greaterthanequalButton.setSelected(true);
execState = state;
} else if (state == SizeAssertion.LESSTHANEQUAL) {
} else if (state == SizeAssertion.ComparisonOperator.LESSTHANEQUAL.getValue()) {
lessthanequalButton.setSelected(true);
execState = state;
}
@ -200,12 +200,12 @@ public class SizeAssertionGui extends AbstractAssertionGui implements ActionList
* <p>
* Possible states are
* <ul>
* <li>{@link SizeAssertion#EQUAL}</li>
* <li>{@link SizeAssertion#NOTEQUAL}</li>
* <li>{@link SizeAssertion#GREATERTHAN}</li>
* <li>{@link SizeAssertion#LESSTHAN}</li>
* <li>{@link SizeAssertion#GREATERTHANEQUAL}</li>
* <li>{@link SizeAssertion#LESSTHANEQUAL}</li>
* <li>{@link SizeAssertion.ComparisonOperator#EQUAL}</li>
* <li>{@link SizeAssertion.ComparisonOperator#NOTEQUAL}</li>
* <li>{@link SizeAssertion.ComparisonOperator#GREATERTHAN}</li>
* <li>{@link SizeAssertion.ComparisonOperator#LESSTHAN}</li>
* <li>{@link SizeAssertion.ComparisonOperator#GREATERTHANEQUAL}</li>
* <li>{@link SizeAssertion.ComparisonOperator#LESSTHANEQUAL}</li>
* </ul>
* @return The current state of the radio Button
*/
@ -273,12 +273,12 @@ public class SizeAssertionGui extends AbstractAssertionGui implements ActionList
private Box createComparatorButtonPanel() {
ButtonGroup group = new ButtonGroup();
equalButton = createComparatorButton("=", SizeAssertion.EQUAL, group); //$NON-NLS-1$
notequalButton = createComparatorButton("!=", SizeAssertion.NOTEQUAL, group); //$NON-NLS-1$
greaterthanButton = createComparatorButton(">", SizeAssertion.GREATERTHAN, group); //$NON-NLS-1$
lessthanButton = createComparatorButton("<", SizeAssertion.LESSTHAN, group); //$NON-NLS-1$
greaterthanequalButton = createComparatorButton(">=", SizeAssertion.GREATERTHANEQUAL, group); //$NON-NLS-1$
lessthanequalButton = createComparatorButton("<=", SizeAssertion.LESSTHANEQUAL, group); //$NON-NLS-1$
equalButton = createComparatorButton("=", SizeAssertion.ComparisonOperator.EQUAL.getValue(), group); //$NON-NLS-1$
notequalButton = createComparatorButton("!=", SizeAssertion.ComparisonOperator.NOTEQUAL.getValue(), group); //$NON-NLS-1$
greaterthanButton = createComparatorButton(">", SizeAssertion.ComparisonOperator.GREATERTHAN.getValue(), group); //$NON-NLS-1$
lessthanButton = createComparatorButton("<", SizeAssertion.ComparisonOperator.LESSTHAN.getValue(), group); //$NON-NLS-1$
greaterthanequalButton = createComparatorButton(">=", SizeAssertion.ComparisonOperator.GREATERTHANEQUAL.getValue(), group); //$NON-NLS-1$
lessthanequalButton = createComparatorButton("<=", SizeAssertion.ComparisonOperator.LESSTHANEQUAL.getValue(), group); //$NON-NLS-1$
equalButton.setSelected(true);
execState = Integer.parseInt(equalButton.getActionCommand());

View File

@ -222,20 +222,12 @@ public class CSVDataSet extends ConfigTestElement
private void setAlias(final JMeterContext context, String alias) {
String mode = getShareMode();
int modeInt = CSVDataSetBeanInfo.getShareModeAsInt(mode);
switch(modeInt){
case CSVDataSetBeanInfo.SHARE_ALL:
this.alias = alias;
break;
case CSVDataSetBeanInfo.SHARE_GROUP:
this.alias = alias + "@" + System.identityHashCode(context.getThreadGroup());
break;
case CSVDataSetBeanInfo.SHARE_THREAD:
this.alias = alias + "@" + System.identityHashCode(context.getThread());
break;
default:
this.alias = alias + "@" + mode; // user-specified key
break;
}
this.alias = switch(modeInt){
case CSVDataSetBeanInfo.SHARE_ALL -> alias;
case CSVDataSetBeanInfo.SHARE_GROUP -> alias + "@" + System.identityHashCode(context.getThreadGroup());
case CSVDataSetBeanInfo.SHARE_THREAD -> alias + "@" + System.identityHashCode(context.getThread());
default -> alias + "@" + mode; // user-specified key
};
}
/**

View File

@ -157,12 +157,12 @@ public class JSONPostProcessor
if (matchNumber < 0) {
// Extract all
int index = 1;
StringBuilder concat =
var concat =
new StringBuilder(getComputeConcatenation()
? extractedValues.size() * 20
: 1);
for (Object extractedObject : extractedValues) {
String extractedString = Objects.toString(extractedObject, defaultValue);
var extractedString = Objects.toString(extractedObject, defaultValue);
vars.put(currentRefName + "_" + index,
extractedString); //$NON-NLS-1$
if (getComputeConcatenation()) {

View File

@ -114,26 +114,13 @@ public class TestActionGui extends AbstractSamplerGui { // NOSONAR Ignore hierar
}
action = ta.getAction();
switch (action) {
case TestAction.PAUSE:
pauseButton.setSelected(true);
break;
case TestAction.STOP_NOW:
stopNowButton.setSelected(true);
break;
case TestAction.STOP:
stopButton.setSelected(true);
break;
case TestAction.RESTART_NEXT_LOOP:
restartNextThreadLoopButton.setSelected(true);
break;
case TestAction.START_NEXT_ITERATION_CURRENT_LOOP:
startNextIterationOfCurrentLoopButton.setSelected(true);
break;
case TestAction.BREAK_CURRENT_LOOP:
breakLoopButton.setSelected(true);
break;
default:
break;
case TestAction.PAUSE -> pauseButton.setSelected(true);
case TestAction.STOP_NOW -> stopNowButton.setSelected(true);
case TestAction.STOP -> stopButton.setSelected(true);
case TestAction.RESTART_NEXT_LOOP -> restartNextThreadLoopButton.setSelected(true);
case TestAction.START_NEXT_ITERATION_CURRENT_LOOP -> startNextIterationOfCurrentLoopButton.setSelected(true);
case TestAction.BREAK_CURRENT_LOOP -> breakLoopButton.setSelected(true);
default -> { /* no action needed */ }
}
durationField.setText(ta.getDurationAsString());

View File

@ -44,6 +44,7 @@ import javax.swing.border.EmptyBorder;
import org.apache.jmeter.gui.TestElementMetadata;
import org.apache.jmeter.gui.util.JMeterColor;
import org.apache.jmeter.report.config.ReportGeneratorConfiguration;
import org.apache.jmeter.samplers.Clearable;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.util.JMeterUtils;
@ -255,8 +256,8 @@ public class GraphVisualizer extends AbstractVisualizer implements ImageVisualiz
maxYField = createYAxisField(5);
minYField = createYAxisField(3);
graphYAxisPanel.add(createYAxisPanel("graph_results_ms", maxYField), BorderLayout.NORTH); // $NON-NLS-1$
graphYAxisPanel.add(createYAxisPanel("graph_results_ms", minYField), BorderLayout.SOUTH); // $NON-NLS-1$
graphYAxisPanel.add(createYAxisPanel(ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? "graph_results_ms" : "graph_results_ns", maxYField), BorderLayout.NORTH); // $NON-NLS-1$
graphYAxisPanel.add(createYAxisPanel(ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? "graph_results_ms" : "graph_results_ns", minYField), BorderLayout.SOUTH); // $NON-NLS-1$
return graphYAxisPanel;
}

View File

@ -57,6 +57,7 @@ import org.apache.jmeter.gui.action.ActionRouter;
import org.apache.jmeter.gui.action.SaveGraphics;
import org.apache.jmeter.gui.util.FilePanel;
import org.apache.jmeter.gui.util.VerticalPanel;
import org.apache.jmeter.report.config.ReportGeneratorConfiguration;
import org.apache.jmeter.samplers.Clearable;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.testelement.TestElement;
@ -164,7 +165,7 @@ public class RespTimeGraphVisualizer extends AbstractVisualizer implements Actio
private static final String Y_AXIS_LABEL = JMeterUtils.getResString("aggregate_graph_response_time");//$NON-NLS-1$
private static final String Y_AXIS_TITLE = JMeterUtils.getResString("aggregate_graph_ms"); //$NON-NLS-1$
private static final String Y_AXIS_TITLE = JMeterUtils.getResString(ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? "aggregate_graph_ms" : "aggregate_graph_ns"); //$NON-NLS-1$
/**
* Lock used to protect list update
@ -410,7 +411,7 @@ public class RespTimeGraphVisualizer extends AbstractVisualizer implements Actio
long keyShift = minStartTime + idx;
StatCalculatorLong value = subList.get(keyShift);
if (value != null) {
nanLast = value.getMean();
nanLast = ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? value.getMean() / 100000.0D : value.getMean();
data[s][idx] = nanLast;
// Calculate intermediate values (if needed)
int nlsize = nanList.size();
@ -556,7 +557,7 @@ public class RespTimeGraphVisualizer extends AbstractVisualizer implements Actio
tempList.addAll(internalList);
this.clearData();
for (RespTimeGraphDataBean data : tempList) {
SampleResult sr = new SampleResult(data.getStartTime(), data.getTime());
SampleResult sr = new SampleResult(data.getStartTime() / 1000000L / 1000000L, data.getTime() / 1000000L / 1000000L);
sr.setSampleLabel(data.getSamplerLabel());
this.add(sr);
}

View File

@ -67,6 +67,7 @@ import org.apache.jmeter.gui.util.JSyntaxSearchToolBar;
import org.apache.jmeter.gui.util.JSyntaxTextArea;
import org.apache.jmeter.gui.util.JTextScrollPane;
import org.apache.jmeter.gui.util.TextBoxDialoger.TextBoxDoubleClick;
import org.apache.jmeter.report.config.ReportGeneratorConfiguration;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jmeter.visualizers.SearchTextExtension.JEditorPaneSearchProvider;
@ -266,7 +267,7 @@ public abstract class SamplerResultTab implements ResultRenderer {
.getResString("view_results_thread_name")).append(SPACE) //$NON-NLS-1$
.append(sampleResult.getThreadName()).append(NL);
String startTime = dateFormat
.format(Instant.ofEpochMilli(sampleResult.getStartTime()));
.format(Instant.ofEpochMilli(sampleResult.getStartTime() / 1000000L));
statsBuff
.append(JMeterUtils
.getResString("view_results_sample_start")).append(SPACE) //$NON-NLS-1$
@ -274,15 +275,15 @@ public abstract class SamplerResultTab implements ResultRenderer {
statsBuff
.append(JMeterUtils
.getResString("view_results_load_time")).append(SPACE) //$NON-NLS-1$
.append(sampleResult.getTime()).append(NL);
.append(ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? sampleResult.getTime() / 1000000L : sampleResult.getTime()).append(NL);
statsBuff
.append(JMeterUtils
.getResString("view_results_connect_time")).append(SPACE) //$NON-NLS-1$
.append(sampleResult.getConnectTime()).append(NL);
.append(ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? sampleResult.getConnectTime() / 1000000L : sampleResult.getConnectTime()).append(NL);
statsBuff
.append(JMeterUtils
.getResString("view_results_latency")).append(SPACE) //$NON-NLS-1$
.append(sampleResult.getLatency()).append(NL);
.append(ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? sampleResult.getLatency() / 1000000L : sampleResult.getLatency()).append(NL);
statsBuff
.append(JMeterUtils
.getResString("view_results_size_in_bytes")).append(SPACE) //$NON-NLS-1$
@ -376,13 +377,13 @@ public abstract class SamplerResultTab implements ResultRenderer {
startTime));
resultModel.addRow(new RowResult(
JMeterUtils.getParsedLabel("view_results_load_time"), //$NON-NLS-1$
sampleResult.getTime()));
ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? sampleResult.getTime() / 1000000L : sampleResult.getTime()));
resultModel.addRow(new RowResult(
JMeterUtils.getParsedLabel("view_results_connect_time"), //$NON-NLS-1$
sampleResult.getConnectTime()));
ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? sampleResult.getConnectTime() / 1000000L : sampleResult.getConnectTime()));
resultModel.addRow(new RowResult(
JMeterUtils.getParsedLabel("view_results_latency"), //$NON-NLS-1$
sampleResult.getLatency()));
ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? sampleResult.getLatency() / 1000000L : sampleResult.getLatency()));
resultModel.addRow(new RowResult(
JMeterUtils
.getParsedLabel("view_results_size_in_bytes"), //$NON-NLS-1$

View File

@ -73,6 +73,7 @@ import org.apache.jmeter.gui.util.FileDialoger;
import org.apache.jmeter.gui.util.FilePanel;
import org.apache.jmeter.gui.util.HeaderAsPropertyRendererWrapper;
import org.apache.jmeter.gui.util.VerticalPanel;
import org.apache.jmeter.report.config.ReportGeneratorConfiguration;
import org.apache.jmeter.samplers.Clearable;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.save.CSVSaveService;
@ -202,7 +203,7 @@ public class StatGraphVisualizer extends AbstractVisualizer implements Clearable
private final String yAxisLabel = JMeterUtils.getResString("aggregate_graph_response_time");//$NON-NLS-1$
private final String yAxisTitle = JMeterUtils.getResString("aggregate_graph_ms"); //$NON-NLS-1$
private final String yAxisTitle = JMeterUtils.getResString(ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? "aggregate_graph_ms" : "aggregate_graph_ns"); //$NON-NLS-1$
private boolean saveGraphToFile = false;

View File

@ -546,12 +546,14 @@ implements ActionListener, TreeSelectionListener, Clearable, ItemListener {
// they are ready to wait.
int len = res.getResponseDataAsString().length();
if (MAX_DISPLAY_SIZE > 0 && len > MAX_DISPLAY_SIZE) {
StringBuilder builder = new StringBuilder(MAX_DISPLAY_SIZE + 100);
builder.append(JMeterUtils.getResString("view_results_response_too_large_message")) //$NON-NLS-1$
.append(len).append(" > Max: ").append(MAX_DISPLAY_SIZE)
.append(", ").append(JMeterUtils.getResString("view_results_response_partial_message")) // $NON-NLS-1$
.append("\n").append(res.getResponseDataAsString(), 0, MAX_DISPLAY_SIZE).append("\n...");
response = builder.toString();
response = """
%s%d > Max: %d, %s
%s
...""".formatted(
JMeterUtils.getResString("view_results_response_too_large_message"), //$NON-NLS-1$
len, MAX_DISPLAY_SIZE,
JMeterUtils.getResString("view_results_response_partial_message"), // $NON-NLS-1$
res.getResponseDataAsString().substring(0, MAX_DISPLAY_SIZE));
} else {
response = res.getResponseDataAsString();
}

View File

@ -24,6 +24,7 @@ import java.util.Map;
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
import org.apache.jmeter.control.TransactionController;
import org.apache.jmeter.report.config.ReportGeneratorConfiguration;
import org.apache.jmeter.report.processor.DescriptiveStatisticsFactory;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.util.JMeterUtils;
@ -178,15 +179,15 @@ public class SamplerMetric {
*/
public synchronized void resetForTimeInterval() {
switch (globalWindowMode) {
case FIXED:
// We don't clear responsesStats nor usersStats as it will slide as per my understanding of
// http://commons.apache.org/proper/commons-math/userguide/stat.html
break;
case TIMED:
for (DescriptiveStatistics stat : windowedStats) {
stat.clear();
case FIXED -> {
// We don't clear responsesStats nor usersStats as it will slide as per my understanding of
// http://commons.apache.org/proper/commons-math/userguide/stat.html
}
case TIMED -> {
for (DescriptiveStatistics stat : windowedStats) {
stat.clear();
}
}
break;
}
errors.clear();
successes = 0;
@ -230,7 +231,7 @@ public class SamplerMetric {
* been added yet
*/
public double getOkMaxTime() {
return okResponsesStats.getMax();
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? okResponsesStats.getMax() / 1000000.0D : okResponsesStats.getMax();
}
/**
@ -240,7 +241,7 @@ public class SamplerMetric {
* added yet
*/
public double getOkMinTime() {
return okResponsesStats.getMin();
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? okResponsesStats.getMin() / 1000000.0D : okResponsesStats.getMin();
}
/**
@ -249,7 +250,7 @@ public class SamplerMetric {
* @return The arithmetic mean of the stored values
*/
public double getOkMean() {
return okResponsesStats.getMean();
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? okResponsesStats.getMean() / 1000000.0D : okResponsesStats.getMean();
}
/**
@ -261,7 +262,7 @@ public class SamplerMetric {
* values.
*/
public double getOkPercentile(double percentile) {
return okResponsesStats.getPercentile(percentile);
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? okResponsesStats.getMean() / 1000000.0D : okResponsesStats.getMean();
}
/**
@ -271,7 +272,7 @@ public class SamplerMetric {
* been added yet
*/
public double getKoMaxTime() {
return koResponsesStats.getMax();
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? koResponsesStats.getMax() / 1000000.0D : koResponsesStats.getMax();
}
/**
@ -281,7 +282,7 @@ public class SamplerMetric {
* added yet
*/
public double getKoMinTime() {
return koResponsesStats.getMin();
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? koResponsesStats.getMin() / 1000000.0D : koResponsesStats.getMin();
}
/**
@ -290,7 +291,7 @@ public class SamplerMetric {
* @return The arithmetic mean of the stored values
*/
public double getKoMean() {
return koResponsesStats.getMean();
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? koResponsesStats.getMean() / 1000000.0D : koResponsesStats.getMean();
}
/**
@ -302,7 +303,7 @@ public class SamplerMetric {
* values.
*/
public double getKoPercentile(double percentile) {
return koResponsesStats.getPercentile(percentile);
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? koResponsesStats.getPercentile(percentile) / 1000000.0D : koResponsesStats.getPercentile(percentile);
}
/**
@ -312,7 +313,7 @@ public class SamplerMetric {
* been added yet
*/
public double getAllMaxTime() {
return allResponsesStats.getMax();
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? allResponsesStats.getMax() / 1000000.0D : allResponsesStats.getMax();
}
/**
@ -322,7 +323,7 @@ public class SamplerMetric {
* added yet
*/
public double getAllMinTime() {
return allResponsesStats.getMin();
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? allResponsesStats.getMin() / 1000000.0D : allResponsesStats.getMin();
}
/**
@ -331,7 +332,7 @@ public class SamplerMetric {
* @return The arithmetic mean of the stored values
*/
public double getAllMean() {
return allResponsesStats.getMean();
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? allResponsesStats.getMean() / 1000000.0D : allResponsesStats.getMean();
}
/**
@ -343,7 +344,7 @@ public class SamplerMetric {
* values.
*/
public double getAllPercentile(double percentile) {
return pctResponseStats.getPercentile(percentile);
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? pctResponseStats.getPercentile(percentile) / 1000000.0D : pctResponseStats.getPercentile(percentile);
}
/**

View File

@ -23,6 +23,7 @@ import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.jmeter.config.Arguments;
import org.apache.jmeter.report.config.ReportGeneratorConfiguration;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.visualizers.backend.BackendListenerClient;
import org.apache.jmeter.visualizers.backend.BackendListenerContext;
@ -125,7 +126,7 @@ public class InfluxDBRawBackendListenerClient implements BackendListenerClient {
private void addMetricFromSampleResult(SampleResult sampleResult) {
String tags = "," + createTags(sampleResult);
String fields = createFields(sampleResult);
long timestamp = sampleResult.getTimeStamp();
long timestamp = ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? sampleResult.getTimeStamp() / 1000000L : sampleResult.getTimeStamp();
influxDBMetricsManager.addMetric(measurement, tags, fields, timestamp);
}
@ -145,9 +146,9 @@ public class InfluxDBRawBackendListenerClient implements BackendListenerClient {
@VisibleForTesting
static String createFields(SampleResult sampleResult) {
long duration = sampleResult.getTime();
long latency = sampleResult.getLatency();
long connectTime = sampleResult.getConnectTime();
long duration = ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? sampleResult.getTime() / 1000000L : sampleResult.getTime();
long latency = ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? sampleResult.getLatency() / 1000000L : sampleResult.getLatency();
long connectTime = ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? sampleResult.getConnectTime() / 1000000L : sampleResult.getConnectTime();
return "duration=" + duration
+ ",ttfb=" + latency
+ ",connectTime=" + connectTime;

View File

@ -55,7 +55,7 @@ public class SizeAssertionTest extends JMeterTestCase {
@Test
public void testSizeAssertionEquals() throws Exception {
assertion.setCompOper(SizeAssertion.EQUAL);
assertion.setCompOper(SizeAssertion.ComparisonOperator.EQUAL.getValue());
assertion.setAllowedSize(0);
result = assertion.getResult(sample1);
assertFailed();
@ -73,7 +73,7 @@ public class SizeAssertionTest extends JMeterTestCase {
@Test
public void testSizeAssertionNotEquals() throws Exception {
assertion.setCompOper(SizeAssertion.NOTEQUAL);
assertion.setCompOper(SizeAssertion.ComparisonOperator.NOTEQUAL.getValue());
assertion.setAllowedSize(0);
result = assertion.getResult(sample1);
assertPassed();
@ -91,7 +91,7 @@ public class SizeAssertionTest extends JMeterTestCase {
@Test
public void testSizeAssertionGreaterThan() throws Exception {
assertion.setCompOper(SizeAssertion.GREATERTHAN);
assertion.setCompOper(SizeAssertion.ComparisonOperator.GREATERTHAN.getValue());
assertion.setAllowedSize(0);
result = assertion.getResult(sample1);
assertPassed();
@ -109,7 +109,7 @@ public class SizeAssertionTest extends JMeterTestCase {
@Test
public void testSizeAssertionGreaterThanEqual() throws Exception {
assertion.setCompOper(SizeAssertion.GREATERTHANEQUAL);
assertion.setCompOper(SizeAssertion.ComparisonOperator.GREATERTHANEQUAL.getValue());
assertion.setAllowedSize(0);
result = assertion.getResult(sample1);
assertPassed();
@ -127,7 +127,7 @@ public class SizeAssertionTest extends JMeterTestCase {
@Test
public void testSizeAssertionLessThan() throws Exception {
assertion.setCompOper(SizeAssertion.LESSTHAN);
assertion.setCompOper(SizeAssertion.ComparisonOperator.LESSTHAN.getValue());
assertion.setAllowedSize(0);
result = assertion.getResult(sample1);
assertFailed();
@ -145,7 +145,7 @@ public class SizeAssertionTest extends JMeterTestCase {
@Test
public void testSizeAssertionLessThanEqual() throws Exception {
assertion.setCompOper(SizeAssertion.LESSTHANEQUAL);
assertion.setCompOper(SizeAssertion.ComparisonOperator.LESSTHANEQUAL.getValue());
assertion.setAllowedSize(0);
result = assertion.getResult(sample1);
assertFailed();

View File

@ -86,8 +86,10 @@ class TestJSONPostProcessor {
processor.setJsonPathExpressions(path);
processor.setRefNames("result");
accessMode.configure(processor);
SampleResult sampleResult = createSampleResult("{\"a\": 23, \"b\": \"parent_only\"}");
sampleResult.addSubResult(createSampleResult("{\"a\": 42, \"c\": \"child_only\"}"));
SampleResult sampleResult = createSampleResult("""
{"a": 23, "b": "parent_only"}""");
sampleResult.addSubResult(createSampleResult("""
{"a": 42, "c": "child_only"}"""));
context.setPreviousResult(sampleResult);
context.setVariables(vars);
processor.process();
@ -297,7 +299,8 @@ class TestJSONPostProcessor {
void testExtractComplexElements() {
JMeterContext context = JMeterContextService.getContext();
JSONPostProcessor processor = setupProcessor(context, "-1");
String data = "[{\"a\":[1,{\"d\":2},3]},[\"b\",{\"h\":23}],3]";
String data = """
[{"a":[1,{"d":2},3]},["b",{"h":23}],3]""";
SampleResult result = new SampleResult();
result.setResponseData(data.getBytes(StandardCharsets.UTF_8));
JMeterVariables vars = new JMeterVariables();
@ -310,8 +313,10 @@ class TestJSONPostProcessor {
String jsonWithoutOuterParens = data.substring(1, data.length() - 1);
assertEquals(jsonWithoutOuterParens, vars.get(VAR_NAME + "_ALL"));
assertEquals("{\"a\":[1,{\"d\":2},3]}", vars.get(VAR_NAME + "_1"));
assertEquals("[\"b\",{\"h\":23}]", vars.get(VAR_NAME + "_2"));
assertEquals("""
{"a":[1,{"d":2},3]}""", vars.get(VAR_NAME + "_1"));
assertEquals("""
["b",{"h":23}]""", vars.get(VAR_NAME + "_2"));
assertEquals("3", vars.get(VAR_NAME + "_3"));
assertEquals("3", vars.get(VAR_NAME + "_matchNr"));

View File

@ -95,7 +95,7 @@ public class SamplerMetricFixedModeTest {
result.setSampleCount(1);
result.setErrorCount(success ? 0 : 1);
result.sampleStart();
result.setEndTime(result.getStartTime() + DEFAULT_ELAPSED_TIME);
result.setEndTime_ns(result.getStartTime() + DEFAULT_ELAPSED_TIME * 1000000L);
result.setSentBytes(1000);
result.setBytes(2000L);
return result;
@ -116,7 +116,7 @@ public class SamplerMetricFixedModeTest {
result.setSuccessful(success);
result.addSubResult(createSampleResult(success));
result.addSubResult(createSampleResult(success));
result.setEndTime(Arrays.stream(result.getSubResults()).mapToLong(SampleResult::getEndTime).max().orElse(0));
result.setEndTime_ns(Arrays.stream(result.getSubResults()).mapToLong(SampleResult::getEndTime).max().orElse(0));
result.setBytes(Arrays.stream(result.getSubResults()).mapToLong(SampleResult::getBytesAsLong).sum());
result.setSentBytes(Arrays.stream(result.getSubResults()).mapToLong(SampleResult::getSentBytes).sum());
result.setResponseMessage("Number of samples in transaction : "); // This is a constant in TransactionController

View File

@ -86,7 +86,7 @@ public class SamplerMetricTimedModeTest {
result.sampleStart();
result.setSentBytes(1000);
result.setBytes(2000L);
result.setEndTime(result.getStartTime() + DEFAULT_ELAPSED_TIME);
result.setEndTime_ns(result.getStartTime() + DEFAULT_ELAPSED_TIME * 1000000L);
return result;
}
@ -98,7 +98,7 @@ public class SamplerMetricTimedModeTest {
result.setSuccessful(success);
result.addSubResult(createSampleResult(success));
result.addSubResult(createSampleResult(success));
result.setEndTime(Arrays.stream(result.getSubResults()).mapToLong(SampleResult::getEndTime).max().orElse(0));
result.setEndTime_ns(Arrays.stream(result.getSubResults()).mapToLong(SampleResult::getEndTime).max().orElse(0));
result.setBytes(Arrays.stream(result.getSubResults()).mapToLong(SampleResult::getBytesAsLong).sum());
result.setSentBytes(Arrays.stream(result.getSubResults()).mapToLong(SampleResult::getSentBytes).sum());
result.setResponseMessage("Number of samples in transaction : "); // This is a constant in TransactionController

View File

@ -39,7 +39,6 @@ class CompareAssertionTest {
fun simpleResult(data: String, elapsed: Long) =
SampleResult(0, elapsed).apply {
setResponseData(data, Charsets.UTF_8.name())
sampleEnd()
}
@JvmStatic

View File

@ -215,7 +215,7 @@ public class TransactionController extends GenericController implements SampleLi
long processingTimeOfLastChild = res.currentTimeInMillis() - prevEndTime;
pauseTime += processingTimeOfLastChild;
}
res.setIdleTime(pauseTime+res.getIdleTime());
res.setIdleTime_ns(pauseTime+res.getIdleTime());
res.sampleEnd();
res.setResponseMessage(
TransactionController.NUMBER_OF_SAMPLES_IN_TRANSACTION_PREFIX
@ -252,7 +252,7 @@ public class TransactionController extends GenericController implements SampleLi
public void triggerEndOfLoop() {
if(!isGenerateParentSample()) {
if (res != null) {
res.setIdleTime(pauseTime + res.getIdleTime());
res.setIdleTime_ns(pauseTime + res.getIdleTime());
res.sampleEnd();
res.setSuccessful(TRUE.equals(JMeterContextService.getContext().getVariables().get(JMeterThread.LAST_SAMPLE_OK)));
res.setResponseMessage(
@ -320,8 +320,8 @@ public class TransactionController extends GenericController implements SampleLi
}
res.setAllThreads(sampleResult.getAllThreads());
res.setGroupThreads(sampleResult.getGroupThreads());
res.setLatency(res.getLatency() + sampleResult.getLatency());
res.setConnectTime(res.getConnectTime() + sampleResult.getConnectTime());
res.setLatency_ns(res.getLatency() + sampleResult.getLatency());
res.setConnectTime_ns(res.getConnectTime() + sampleResult.getConnectTime());
}
}
}

View File

@ -132,11 +132,11 @@ public class TransactionSampler extends AbstractSampler {
// Bug 50080 (not include pause time when generate parent)
if (!transactionController.isIncludeTimers()) {
long end = transactionSampleResult.currentTimeInMillis();
transactionSampleResult.setIdleTime(end
transactionSampleResult.setIdleTime_ns(end
- transactionSampleResult.getStartTime() - totalTime);
transactionSampleResult.setEndTime(end);
transactionSampleResult.setEndTime_ns(end);
}
transactionSampleResult.setConnectTime(totalConnectTime);
transactionSampleResult.setConnectTime_ns(totalConnectTime);
}
protected void setSubSampler(Sampler subSampler) {

View File

@ -185,13 +185,13 @@ public class StandardJMeterEngine implements JMeterEngine, Runnable {
@Override
public void configure(HashTree testTree) {
// Is testplan serialised?
SearchByClass<TestPlan> testPlan = new SearchByClass<>(TestPlan.class);
var testPlan = new SearchByClass<>(TestPlan.class);
testTree.traverse(testPlan);
Object[] plan = testPlan.getSearchResults().toArray();
var plan = testPlan.getSearchResults().toArray();
if (plan.length == 0) {
throw new IllegalStateException("Could not find the TestPlan class!");
}
TestPlan tp = (TestPlan) plan[0];
var tp = (TestPlan) plan[0];
serialized = tp.isSerialized();
tearDownOnShutdown = tp.isTearDownOnShutdown();
active = true;
@ -409,7 +409,7 @@ public class StandardJMeterEngine implements JMeterEngine, Runnable {
JMeterContextService.startTest();
try {
PreCompiler compiler = new PreCompiler();
var compiler = new PreCompiler();
test.traverse(compiler);
} catch (RuntimeException e) {
log.error("Error occurred compiling the tree:",e);
@ -420,7 +420,7 @@ public class StandardJMeterEngine implements JMeterEngine, Runnable {
* Notification of test listeners needs to happen after function
* replacement, but before setting RunningVersion to true.
*/
SearchByClass<TestStateListener> testListeners = new SearchByClass<>(TestStateListener.class); // TL - S&E
var testListeners = new SearchByClass<>(TestStateListener.class); // TL - S&E
test.traverse(testListeners);
// Merge in any additional test listeners
@ -431,12 +431,12 @@ public class StandardJMeterEngine implements JMeterEngine, Runnable {
test.traverse(new TurnElementsOn());
notifyTestListenersOfStart(testListeners);
List<?> testLevelElements = new ArrayList<>(test.list(test.getArray()[0]));
var testLevelElements = new ArrayList<>(test.list(test.getArray()[0]));
removeThreadGroups(testLevelElements);
SearchByClass<SetupThreadGroup> setupSearcher = new SearchByClass<>(SetupThreadGroup.class);
SearchByClass<AbstractThreadGroup> searcher = new SearchByClass<>(AbstractThreadGroup.class);
SearchByClass<PostThreadGroup> postSearcher = new SearchByClass<>(PostThreadGroup.class);
var setupSearcher = new SearchByClass<>(SetupThreadGroup.class);
var searcher = new SearchByClass<>(AbstractThreadGroup.class);
var postSearcher = new SearchByClass<>(PostThreadGroup.class);
test.traverse(setupSearcher);
test.traverse(searcher);
@ -446,11 +446,11 @@ public class StandardJMeterEngine implements JMeterEngine, Runnable {
// for each thread group, generate threads
// hand each thread the sampler controller
// and the listeners, and the timer
Iterator<SetupThreadGroup> setupIter = setupSearcher.getSearchResults().iterator();
Iterator<AbstractThreadGroup> iter = searcher.getSearchResults().iterator();
Iterator<PostThreadGroup> postIter = postSearcher.getSearchResults().iterator();
var setupIter = setupSearcher.getSearchResults().iterator();
var iter = searcher.getSearchResults().iterator();
var postIter = postSearcher.getSearchResults().iterator();
ListenerNotifier notifier = new ListenerNotifier();
var notifier = new ListenerNotifier();
int groupCount = 0;
JMeterContextService.clearTotalThreads();
@ -458,9 +458,9 @@ public class StandardJMeterEngine implements JMeterEngine, Runnable {
if (setupIter.hasNext()) {
log.info("Starting setUp thread groups");
while (running && setupIter.hasNext()) {//for each setup thread group
AbstractThreadGroup group = setupIter.next();
var group = setupIter.next();
groupCount++;
String groupName = group.getName();
var groupName = group.getName();
log.info("Starting setUp ThreadGroup: {} : {} ", groupCount, groupName);
startThreadGroup(group, groupCount, setupSearcher, testLevelElements, notifier);
if (serialized && setupIter.hasNext()) {
@ -489,7 +489,7 @@ public class StandardJMeterEngine implements JMeterEngine, Runnable {
JMeterContextService.getContext().setSamplingStarted(true);
boolean mainGroups = running; // still running at this point, i.e. setUp was not cancelled
while (running && iter.hasNext()) {// for each thread group
AbstractThreadGroup group = iter.next();
var group = iter.next();
//ignore Setup and Post here. We could have filtered the searcher. but then
//future Thread Group objects wouldn't execute.
if (group instanceof SetupThreadGroup ||
@ -497,7 +497,7 @@ public class StandardJMeterEngine implements JMeterEngine, Runnable {
continue;
}
groupCount++;
String groupName = group.getName();
var groupName = group.getName();
log.info("Starting ThreadGroup: {} : {}", groupCount, groupName);
startThreadGroup(group, groupCount, searcher, testLevelElements, notifier);
if (serialized && iter.hasNext()) {
@ -527,9 +527,9 @@ public class StandardJMeterEngine implements JMeterEngine, Runnable {
running = tearDownOnShutdown; // re-enable for tearDown if necessary
}
while (running && postIter.hasNext()) {//for each setup thread group
AbstractThreadGroup group = postIter.next();
var group = postIter.next();
groupCount++;
String groupName = group.getName();
var groupName = group.getName();
log.info("Starting tearDown ThreadGroup: {} : {}", groupCount, groupName);
startThreadGroup(group, groupCount, postSearcher, testLevelElements, notifier);
if (serialized && postIter.hasNext()) {
@ -557,7 +557,7 @@ public class StandardJMeterEngine implements JMeterEngine, Runnable {
boolean onErrorStopTestNow = group.getOnErrorStopTestNow();
boolean onErrorStopThread = group.getOnErrorStopThread();
boolean onErrorStartNextLoop = group.getOnErrorStartNextLoop();
String groupName = group.getName();
var groupName = group.getName();
log.info("Starting {} threads for group {}.", numThreads, groupName);
if (onErrorStopTest) {
log.info("Test will stop on error");
@ -570,7 +570,7 @@ public class StandardJMeterEngine implements JMeterEngine, Runnable {
} else {
log.info("Thread will continue on error");
}
ListedHashTree threadGroupTree = (ListedHashTree) searcher.getSubTree(group);
var threadGroupTree = (ListedHashTree) searcher.getSubTree(group);
threadGroupTree.add(group, testLevelElements);
groups.add(group);

View File

@ -432,13 +432,12 @@ public final class GuiPackage implements LocaleChangeListener, HistoryListener {
}
private void updateUi(JMeterGUIComponent comp) {
if (!(comp instanceof JComponent)) {
if (!(comp instanceof JComponent jc)) {
return;
}
JComponent jc = (JComponent) comp;
Object epoch = jc.getClientProperty(LAF_EPOCH);
int currentLafEpoch = lafEpoch.get();
if (epoch instanceof Integer && ((Integer) epoch) < currentLafEpoch) {
if (epoch instanceof Integer epochInt && epochInt < currentLafEpoch) {
JFactory.updateUi(jc);
}
jc.putClientProperty(LAF_EPOCH, currentLafEpoch);

View File

@ -28,6 +28,7 @@ import java.util.Properties;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.apache.jmeter.util.JMeterUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -125,6 +126,9 @@ public class ReportGeneratorConfiguration {
public static final String SUBCONF_KEY_CLASSNAME = "classname";
public static final String SUBCONF_KEY_PROPERTY = "property";
public static final String jmeter_reportgenerator_ms_ns = "ms".equalsIgnoreCase(JMeterUtils.getProperty(REPORT_GENERATOR_KEY_PREFIX + KEY_DELIMITER + "ms_ns")) ? "ms" : "ns".equalsIgnoreCase(JMeterUtils.getProperty(REPORT_GENERATOR_KEY_PREFIX + KEY_DELIMITER + "ms_ns")) ? "ns" : "ms";
public static final boolean jmeter_reportgenerator_ms_ns_isMs = "ms".equals(jmeter_reportgenerator_ms_ns);
private static final class ExporterConfigurationFactory implements
SubConfigurationFactory<ExporterConfiguration> {
private final Props props;

View File

@ -148,7 +148,10 @@ public class Sample {
* @return the time stamp
*/
public long getTimestamp() {
return getData(long.class, CSVSaveService.TIME_STAMP);
if (metadata.indexOf(CSVSaveService.TIME_STAMP_NS) > -1) {
return getData(long.class, CSVSaveService.TIME_STAMP_NS);
}
return getData(long.class, CSVSaveService.TIME_STAMP) * 1000000L;
}
/**
@ -157,7 +160,10 @@ public class Sample {
* @return the elapsed time stored in the sample
*/
public long getElapsedTime() {
return getData(long.class, CSVSaveService.CSV_ELAPSED);
if (metadata.indexOf(CSVSaveService.CSV_ELAPSED_NS) > -1) {
return getData(long.class, CSVSaveService.CSV_ELAPSED_NS);
}
return getData(long.class, CSVSaveService.CSV_ELAPSED) * 1000000L;
}
/**
@ -242,7 +248,10 @@ public class Sample {
* @return the latency stored in the sample
*/
public long getLatency() {
return getData(long.class, CSVSaveService.CSV_LATENCY);
if (metadata.indexOf(CSVSaveService.CSV_LATENCY_NS) > -1) {
return getData(long.class, CSVSaveService.CSV_LATENCY_NS);
}
return getData(long.class, CSVSaveService.CSV_LATENCY) * 1000000L;
}
/**
@ -251,8 +260,11 @@ public class Sample {
* @return the connect time stored in the sample or 0 is column is not in results
*/
public long getConnectTime() {
if (metadata.indexOf(CSVSaveService.CSV_CONNECT_TIME_NS) > -1) {
return getData(long.class, CSVSaveService.TIME_STAMP_NS);
}
if(metadata.indexOf(CSVSaveService.CSV_CONNECT_TIME) >= 0) {
return getData(long.class, CSVSaveService.CSV_CONNECT_TIME);
return getData(long.class, CSVSaveService.CSV_CONNECT_TIME) * 1000000L;
} else {
return 0L;
}

View File

@ -78,7 +78,7 @@ public class TimeHelper {
*/
@SuppressWarnings("JavaUtilDate")
public static String formatTimeStamp(long timeStamp, String format) {
SimpleDateFormat dateFormat = format != null ? new SimpleDateFormat(
SimpleDateFormat dateFormat = format != null && !"ms".equals(format) ? new SimpleDateFormat(
format) : new SimpleDateFormat();
return dateFormat.format(new Date(timeStamp));
}

View File

@ -438,6 +438,8 @@ public class HtmlTemplateExporter extends AbstractDataExporter {
// Add the overall filter property to the context
addToContext(DATA_CTX_OVERALL_FILTER, configuration.getSampleFilter(), dataContext);
dataContext.put("jmeter_reportgenerator_ms_ns", ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns);
// Walk template directory to copy files and process templated ones
Configuration templateCfg = new Configuration(Configuration.VERSION_2_3_30);
try {

View File

@ -500,7 +500,7 @@ public class ReportGenerator {
*/
private static AggregateConsumer createEndDateConsumer() {
AggregateConsumer endDateConsumer = new AggregateConsumer(
new MaxAggregator(), sample -> (double) sample.getEndTime());
new MaxAggregator(), sample -> ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? (double) sample.getEndTime() : sample.getEndTime() / 1000000.0D);
endDateConsumer.setName(END_DATE_CONSUMER_NAME);
return endDateConsumer;
}
@ -510,7 +510,7 @@ public class ReportGenerator {
*/
private static AggregateConsumer createBeginDateConsumer() {
AggregateConsumer beginDateConsumer = new AggregateConsumer(
new MinAggregator(), sample -> (double) sample.getStartTime());
new MinAggregator(), sample -> ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? (double) sample.getStartTime() : sample.getStartTime() / 1000000.0D);
beginDateConsumer.setName(BEGIN_DATE_CONSUMER_NAME);
return beginDateConsumer;
}

View File

@ -122,19 +122,19 @@ public class ApdexSummaryConsumer extends
// Increment the counters depending on the elapsed time.
ApdexThresholdsInfo thresholdsInfo = data.getApdexThresholdInfo();
if (elapsedTime <= thresholdsInfo.getSatisfiedThreshold()) {
if (elapsedTime <= thresholdsInfo.getSatisfiedThreshold() * 1000000L) {
data.incSatisfiedCount();
} else if (elapsedTime <= thresholdsInfo.getToleratedThreshold()) {
} else if (elapsedTime <= thresholdsInfo.getToleratedThreshold() * 1000000L) {
data.incToleratedCount();
}
// Increment the overall counters depending on the elapsed time.
ApdexThresholdsInfo overallThresholdsInfo = overallData
.getApdexThresholdInfo();
if (elapsedTime <= overallThresholdsInfo.getSatisfiedThreshold()) {
if (elapsedTime <= overallThresholdsInfo.getSatisfiedThreshold() * 1000000L) {
overallData.incSatisfiedCount();
} else if (elapsedTime <= overallThresholdsInfo
.getToleratedThreshold()) {
.getToleratedThreshold() * 1000000L) {
overallData.incToleratedCount();
}
}

View File

@ -17,6 +17,8 @@
package org.apache.jmeter.report.processor;
import org.apache.jmeter.report.config.ReportGeneratorConfiguration;
/**
* The class MaxAggregator is used to get maximum from samples.
*
@ -44,7 +46,7 @@ public class MaxAggregator implements Aggregator {
*/
@Override
public double getResult() {
return value;
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? value / 1000000.0D : value;
}
/*

View File

@ -18,6 +18,7 @@
package org.apache.jmeter.report.processor;
import org.apache.commons.math3.stat.descriptive.moment.Mean;
import org.apache.jmeter.report.config.ReportGeneratorConfiguration;
/**
* The class MeanAggregator is used to get mean from samples.
@ -26,7 +27,7 @@ import org.apache.commons.math3.stat.descriptive.moment.Mean;
*/
public class MeanAggregator implements Aggregator {
private final Mean mean = new Mean();
protected final Mean mean = new Mean();
/*
* (non-Javadoc)
@ -45,7 +46,7 @@ public class MeanAggregator implements Aggregator {
*/
@Override
public double getResult() {
return mean.getResult();
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? mean.getResult() / 1000000.0D : mean.getResult();
}
/*

View File

@ -17,6 +17,8 @@
package org.apache.jmeter.report.processor;
import org.apache.jmeter.report.config.ReportGeneratorConfiguration;
/**
* The class MinAggregator is used to get minimum from samples.
*
@ -44,7 +46,7 @@ public class MinAggregator implements Aggregator {
*/
@Override
public double getResult() {
return value;
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? value / 1000000.0D : value;
}
/*

View File

@ -107,6 +107,9 @@ public class NormalizerSampleConsumer extends AbstractSampleConsumer {
TIMESTAMP_FORMAT, s.toString()), e);
}
long time = date.getTime();
if (!isMillisFormat) {
time *= 1000000L;
}
int cc = sampleMetadata.getColumnCount();
String[] data = new String[cc];
for (int i = 0; i < cc; i++) {

View File

@ -71,7 +71,7 @@ public class PercentileAggregator implements Aggregator {
*/
@Override
public double getResult() {
return statistics.getPercentile(percentileIndex);
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? statistics.getPercentile(percentileIndex) / 1000000.0D : statistics.getPercentile(percentileIndex);
}
/*

View File

@ -17,6 +17,8 @@
package org.apache.jmeter.report.processor;
import org.apache.jmeter.report.config.ReportGeneratorConfiguration;
/**
* The class ApdexSummaryData provides information for
* StatisticsSummaryConsumer.
@ -41,7 +43,7 @@ public class StatisticsSummaryData {
private long max = Long.MIN_VALUE;
public long getElapsedTime() {
return endTime - firstTime;
return (endTime - firstTime) / 1000000L;
}
/**
@ -50,7 +52,7 @@ public class StatisticsSummaryData {
* @return the firstTime
*/
public final long getFirstTime() {
return firstTime;
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? firstTime / 1000000L : firstTime;
}
/**
@ -69,7 +71,7 @@ public class StatisticsSummaryData {
* @return the endTime
*/
public final long getEndTime() {
return endTime;
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? endTime / 1000000L : endTime;
}
/**
@ -135,7 +137,7 @@ public class StatisticsSummaryData {
* @return the min
*/
public final long getMin() {
return min;
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? min / 1000000L : min;
}
/**
@ -150,7 +152,7 @@ public class StatisticsSummaryData {
* @return the max
*/
public final long getMax() {
return max;
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? max / 1000000L : max;
}
/**

View File

@ -17,6 +17,8 @@
package org.apache.jmeter.report.processor;
import java.math.BigDecimal;
/**
* The class SumAggregator is used to get sum from samples.
*
@ -25,7 +27,7 @@ package org.apache.jmeter.report.processor;
public class SumAggregator implements Aggregator {
private long count = 0;
private double sum = 0;
private BigDecimal sum = BigDecimal.ZERO;
/*
* (non-Javadoc)
@ -44,7 +46,7 @@ public class SumAggregator implements Aggregator {
*/
@Override
public double getResult() {
return sum;
return sum.doubleValue();
}
/*
@ -55,7 +57,7 @@ public class SumAggregator implements Aggregator {
@Override
public void addValue(double value) {
count++;
sum += value;
sum = sum.add(BigDecimal.valueOf(value));
}
/*
@ -66,7 +68,7 @@ public class SumAggregator implements Aggregator {
@Override
public void reset() {
count = 0;
sum = 0;
sum = BigDecimal.ZERO;
}
}

View File

@ -288,6 +288,9 @@ public abstract class AbstractGraphConsumer extends AbstractSampleConsumer {
for (Map.Entry<Double, Aggregator> entry : aggInfo.entrySet()) {
// Init key and value depending on invertKeysAndValues property
Double key = entry.getKey();
if (this instanceof AbstractOverTimeGraphConsumer) {
key /= 1000000.0D;
}
Double value = entry.getValue().getResult();
if (invertKeysAndValues) {

View File

@ -104,6 +104,6 @@ public abstract class AbstractOverTimeGraphConsumer extends
@Override
public void initialize() {
super.initialize();
((TimeStampKeysSelector) getKeysSelector()).setGranularity(granularity);
((TimeStampKeysSelector) getKeysSelector()).setGranularity(granularity * 1000000L);
}
}

View File

@ -219,7 +219,7 @@ public abstract class AbstractVersusRequestsGraphConsumer extends
private Long getTimeInterval(Sample sample) {
long time = sample.getEndTime();
return time - (time % parent.getGranularity());
return time - (time % (parent.getGranularity() * 1000000L));
}
// Adds a new field in the sample metadata for each channel

View File

@ -21,6 +21,8 @@ import java.util.Collections;
import java.util.Map;
import org.apache.jmeter.report.core.Sample;
import org.apache.jmeter.report.processor.Aggregator;
import org.apache.jmeter.report.processor.MeanAggregator;
import org.apache.jmeter.report.processor.MeanAggregatorFactory;
import org.apache.jmeter.report.processor.graph.AbstractGraphConsumer;
import org.apache.jmeter.report.processor.graph.AbstractOverTimeGraphConsumer;
@ -85,7 +87,17 @@ public class ActiveThreadsGraphConsumer extends AbstractOverTimeGraphConsumer {
return Collections.singletonMap(
AbstractGraphConsumer.DEFAULT_GROUP,
new GroupInfo(new MeanAggregatorFactory(), seriesSelector, graphValueSelector, false, false));
new GroupInfo(new MeanAggregatorFactory() {
@Override
protected Aggregator createAggregator() {
return new MeanAggregator() {
@Override
public double getResult() {
return mean.getResult();
}
};
}
}, seriesSelector, graphValueSelector, false, false));
}
}

View File

@ -20,6 +20,7 @@ package org.apache.jmeter.report.processor.graph.impl;
import java.util.Collections;
import java.util.Map;
import org.apache.jmeter.report.config.ReportGeneratorConfiguration;
import org.apache.jmeter.report.processor.MapResultData;
import org.apache.jmeter.report.processor.SumAggregatorFactory;
import org.apache.jmeter.report.processor.ValueResultData;
@ -67,7 +68,7 @@ public class ResponseTimeDistributionGraphConsumer extends
protected final GraphKeysSelector createKeysSelector() {
return sample -> {
long elapsed = sample.getElapsedTime();
return (double) elapsed - elapsed % granularity;
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? (elapsed - elapsed % (granularity * 1000000L)) / 1000000.0D : (double) elapsed - elapsed % (granularity * 1000000L);
};
}

View File

@ -20,6 +20,7 @@ package org.apache.jmeter.report.processor.graph.impl;
import java.util.Collections;
import java.util.Map;
import org.apache.jmeter.report.config.ReportGeneratorConfiguration;
import org.apache.jmeter.report.processor.MapResultData;
import org.apache.jmeter.report.processor.SumAggregatorFactory;
import org.apache.jmeter.report.processor.graph.AbstractGraphConsumer;
@ -56,7 +57,7 @@ public class ResponseTimePercentilesGraphConsumer extends AbstractGraphConsumer
*/
@Override
protected final GraphKeysSelector createKeysSelector() {
return sample -> (double) sample.getElapsedTime();
return sample -> ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? sample.getElapsedTime() / 1000000.0D : (double) sample.getElapsedTime();
}
/*

View File

@ -22,6 +22,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.apache.jmeter.report.config.ReportGeneratorConfiguration;
import org.apache.jmeter.report.core.Sample;
import org.apache.jmeter.report.processor.ListResultData;
import org.apache.jmeter.report.processor.MapResultData;
@ -69,9 +70,9 @@ public class SyntheticResponseTimeDistributionGraphConsumer extends
return Collections.singletonList(FAILED_LABEL);
} else {
long elapsedTime = sample.getElapsedTime();
if (elapsedTime <= getSatisfiedThreshold()) {
if (elapsedTime <= satisfiedThreshold * 1000000L) {
return satisfiedLabels;
} else if (elapsedTime <= getToleratedThreshold()) {
} else if (elapsedTime <= toleratedThreshold * 1000000L) {
return toleratedLabels;
} else {
return untoleratedLabels;
@ -91,9 +92,9 @@ public class SyntheticResponseTimeDistributionGraphConsumer extends
return sample -> {
if (sample.getSuccess()) {
long elapsedTime = sample.getElapsedTime();
if (elapsedTime <= satisfiedThreshold) {
if (elapsedTime <= satisfiedThreshold * 1000000L) {
return (double) 0;
} else if (elapsedTime <= toleratedThreshold) {
} else if (elapsedTime <= toleratedThreshold * 1000000L) {
return 1d;
} else {
return 2d;
@ -124,9 +125,9 @@ public class SyntheticResponseTimeDistributionGraphConsumer extends
protected void initializeExtraResults(MapResultData parentResult) {
ListResultData listResultData = new ListResultData();
String[] seriesLabels = new String[]{
SATISFIED_LABEL.format(new Object[]{getSatisfiedThreshold()}),
TOLERATED_LABEL.format(new Object[]{getSatisfiedThreshold(), getToleratedThreshold()}),
UNTOLERATED_LABEL.format(new Object[]{getToleratedThreshold()}),
SATISFIED_LABEL.format(new Object[] { ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? satisfiedThreshold : satisfiedThreshold * 1000000L, ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns }),
TOLERATED_LABEL.format(new Object[] { ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? satisfiedThreshold : satisfiedThreshold * 1000000L, ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? toleratedThreshold : toleratedThreshold * 1000000L, ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns }),
UNTOLERATED_LABEL.format(new Object[] { ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? toleratedThreshold : toleratedThreshold * 1000000L, ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns }),
FAILED_LABEL
};
String[] colors = new String[]{
@ -191,10 +192,10 @@ public class SyntheticResponseTimeDistributionGraphConsumer extends
private void formatLabels() {
this.satisfiedLabels = Collections.singletonList(
SATISFIED_LABEL.format(new Object[]{this.satisfiedThreshold}));
SATISFIED_LABEL.format(new Object[] { ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? satisfiedThreshold : satisfiedThreshold * 1000000L, ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns }));
this.toleratedLabels = Collections.singletonList(
TOLERATED_LABEL.format(new Object[]{this.satisfiedThreshold, this.toleratedThreshold}));
TOLERATED_LABEL.format(new Object[] { ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? satisfiedThreshold : satisfiedThreshold * 1000000L, ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? toleratedThreshold : toleratedThreshold * 1000000L, ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns }));
this.untoleratedLabels = Collections.singletonList(
UNTOLERATED_LABEL.format(new Object[]{this.toleratedThreshold}));
UNTOLERATED_LABEL.format(new Object[] { ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? toleratedThreshold : toleratedThreshold * 1000000L, ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns }));
}
}

View File

@ -17,8 +17,10 @@
package org.apache.jmeter.reporters;
import java.math.BigInteger;
import java.text.DecimalFormat;
import org.apache.jmeter.report.config.ReportGeneratorConfiguration;
import org.apache.jmeter.samplers.SampleResult;
/**
@ -40,7 +42,7 @@ class SummariserRunningSample {
private long counter;
private long runningSum;
private BigInteger runningSum;
private long max;
@ -79,7 +81,7 @@ class SummariserRunningSample {
private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final)
counter = 0L;
runningSum = 0L;
runningSum = BigInteger.ZERO;
max = Long.MIN_VALUE;
min = Long.MAX_VALUE;
errorCount = 0L;
@ -101,7 +103,7 @@ class SummariserRunningSample {
public void addSample(SummariserRunningSample rs) {
counter += rs.counter;
errorCount += rs.errorCount;
runningSum += rs.runningSum;
runningSum = runningSum.add(rs.runningSum);
if (max < rs.max) {
max = rs.max;
}
@ -120,7 +122,7 @@ class SummariserRunningSample {
counter += res.getSampleCount();
errorCount += res.getErrorCount();
long aTimeInMillis = res.getTime();
runningSum += aTimeInMillis;
runningSum = runningSum.add(BigInteger.valueOf(aTimeInMillis));
if (aTimeInMillis > max) {
max = aTimeInMillis;
}
@ -182,7 +184,7 @@ class SummariserRunningSample {
if (counter == 0) {
return 0;
}
return runningSum / counter;
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? runningSum.divide(BigInteger.valueOf(counter)).divide(BigInteger.valueOf(1000000L)).longValue() : runningSum.divide(BigInteger.valueOf(counter)).longValue();
}
/**
@ -225,7 +227,7 @@ class SummariserRunningSample {
* @return the time in milliseconds of the slowest sample.
*/
public long getMax() {
return max;
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? max / 1000000L : max;
}
/**
@ -234,7 +236,7 @@ class SummariserRunningSample {
* @return the time in milliseconds of the quickest sample.
*/
public long getMin() {
return min;
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? min / 1000000L : min;
}
/**

View File

@ -135,6 +135,9 @@ public class SampleResult implements Serializable, Cloneable, Searchable {
private static final String NULL_FILENAME = "NULL";
private static final long ms = System.currentTimeMillis() * 1000000L;
private static final long ns = System.nanoTime();
static {
if (START_TIMESTAMP) {
log.info("Note: Sample TimeStamps are START times");
@ -147,7 +150,7 @@ public class SampleResult implements Serializable, Cloneable, Searchable {
if (USE_NANO_TIME && NANOTHREAD_SLEEP > 0) {
// Make sure we start with a reasonable value
NanoOffset.nanoOffset = System.currentTimeMillis() - SampleResult.sampleNsClockInMs();
NanoOffset.nanoOffset = ms + System.nanoTime() - ns - sampleNsClockInMs();
NanoOffset nanoOffset = new NanoOffset();
nanoOffset.setDaemon(true);
nanoOffset.setName("NanoOffset");
@ -379,12 +382,12 @@ public class SampleResult implements Serializable, Cloneable, Searchable {
*/
public SampleResult(long stamp, long elapsed) {
this();
stampAndTime(stamp, elapsed);
stampAndTime(stamp * 1000000L, elapsed * 1000000L);
}
private long initOffset(){
if (useNanoTime){
return nanoThreadSleep > 0 ? NanoOffset.getNanoOffset() : System.currentTimeMillis() - sampleNsClockInMs();
return nanoThreadSleep > 0 ? NanoOffset.getNanoOffset() : ms + System.nanoTime() - ns - sampleNsClockInMs();
} else {
return Long.MIN_VALUE;
}
@ -439,7 +442,7 @@ public class SampleResult implements Serializable, Cloneable, Searchable {
}
private static long sampleNsClockInMs() {
return System.nanoTime() / 1000000;
return ms + System.nanoTime() - ns;
}
/**
@ -457,7 +460,7 @@ public class SampleResult implements Serializable, Cloneable, Searchable {
}
return sampleNsClockInMs() + nanoTimeOffset;
}
return System.currentTimeMillis();
return ms + System.nanoTime() - ns;
}
// Helper method to maintain timestamp relationships
@ -485,6 +488,13 @@ public class SampleResult implements Serializable, Cloneable, Searchable {
* set already
*/
public void setStampAndTime(long stamp, long elapsed) {
setStampAndTime_ns(stamp * 1000000L, elapsed * 1000000L);
}
/**
* @see #setStampAndTime, But param in nanosecond format
*/
public void setStampAndTime_ns(long stamp, long elapsed) {
if (startTime != 0 || endTime != 0){
throw new IllegalStateException("Calling setStampAndTime() after start/end times have been set");
}
@ -647,7 +657,7 @@ public class SampleResult implements Serializable, Cloneable, Searchable {
subResult.setThreadName(tn);
// Extend the time to the end of the added sample
setEndTime(Math.max(getEndTime(), subResult.getEndTime() + nanoTimeOffset - subResult.nanoTimeOffset)); // Bug 51855
setEndTime_ns(Math.max(getEndTime(), subResult.getEndTime() + nanoTimeOffset - subResult.nanoTimeOffset)); // Bug 51855
// Include the byte count for the added sample
setBytes(getBytesAsLong() + subResult.getBytesAsLong());
setSentBytes(getSentBytes() + subResult.getSentBytes());
@ -1143,6 +1153,13 @@ public class SampleResult implements Serializable, Cloneable, Searchable {
* allow the original start time to be kept
*/
protected final void setStartTime(long start) {
setStartTime_ns(start * 1000000L);
}
/**
* @see #setStartTime , But param in nanosecond format
*/
protected final void setStartTime_ns(long start) {
startTime = start;
if (START_TIMESTAMP) {
timeStamp = startTime;
@ -1150,6 +1167,13 @@ public class SampleResult implements Serializable, Cloneable, Searchable {
}
public void setEndTime(long end) {
setEndTime_ns(end * 1000000L);
}
/**
* @see #setEndTime , But param in nanosecond format
*/
public void setEndTime_ns(long end) {
endTime = end;
if (!START_TIMESTAMP) {
timeStamp = endTime;
@ -1167,6 +1191,13 @@ public class SampleResult implements Serializable, Cloneable, Searchable {
* @param idle long
*/
public void setIdleTime(long idle) {
setIdleTime_ns(idle * 1000000L);
}
/**
* @see #setIdleTime , But param in nanosecond format
*/
public void setIdleTime_ns(long idle) {
idleTime = idle;
}
@ -1181,7 +1212,7 @@ public class SampleResult implements Serializable, Cloneable, Searchable {
*/
public void sampleStart() {
if (startTime == 0) {
setStartTime(currentTimeInMillis());
setStartTime_ns(currentTimeInMillis());
} else {
log.error("sampleStart called twice", new Throwable(INVALID_CALL_SEQUENCE_MSG));
}
@ -1193,7 +1224,7 @@ public class SampleResult implements Serializable, Cloneable, Searchable {
*/
public void sampleEnd() {
if (endTime == 0) {
setEndTime(currentTimeInMillis());
setEndTime_ns(currentTimeInMillis());
} else {
log.error("sampleEnd called twice", new Throwable(INVALID_CALL_SEQUENCE_MSG));
}
@ -1382,6 +1413,13 @@ public class SampleResult implements Serializable, Cloneable, Searchable {
* The latency to set.
*/
public void setLatency(long latency) {
setLatency_ns(latency * 1000000L);
}
/**
* @see #setLatency , But param in nanosecond format
*/
public void setLatency_ns(long latency) {
this.latency = latency;
}
@ -1405,6 +1443,13 @@ public class SampleResult implements Serializable, Cloneable, Searchable {
* @param time The connect time to set.
*/
public void setConnectTime(long time) {
setConnectTime_ns(time * 1000000L);
}
/**
* @see #setConnectTime , But param in nanosecond format
*/
public void setConnectTime_ns(long time) {
this.connectTime = time;
}
@ -1415,6 +1460,13 @@ public class SampleResult implements Serializable, Cloneable, Searchable {
* The timeStamp to set.
*/
public void setTimeStamp(long timeStamp) {
setTimeStamp_ns(timeStamp * 1000000L);
}
/**
* @see #setTimeStamp , But param in nanosecond format
*/
public void setTimeStamp_ns(long timeStamp) {
this.timeStamp = timeStamp;
}
@ -1561,7 +1613,7 @@ public class SampleResult implements Serializable, Cloneable, Searchable {
private static void getOffset(long wait) {
try {
TimeUnit.MILLISECONDS.sleep(wait);
long clock = System.currentTimeMillis();
long clock = ms + System.nanoTime() - ns;
long nano = SampleResult.sampleNsClockInMs();
nanoOffset = clock - nano;
} catch (InterruptedException ignore) {

View File

@ -51,6 +51,10 @@ public class StatisticalSampleResult extends SampleResult implements
this.elapsed = elapsed;
}
public StatisticalSampleResult(long elapsed) {
this.elapsed = elapsed;
}
/**
* Create a statistical sample result from an ordinary sample result.
*
@ -82,14 +86,14 @@ public class StatisticalSampleResult extends SampleResult implements
// Set start/end times
if (getStartTime()==0){ // Bug 40954 - ensure start time gets started!
this.setStartTime(res.getStartTime());
this.setStartTime_ns(res.getStartTime());
} else {
this.setStartTime(Math.min(getStartTime(), res.getStartTime()));
this.setStartTime_ns(Math.min(getStartTime(), res.getStartTime()));
}
this.setEndTime(Math.max(getEndTime(), res.getEndTime()));
this.setEndTime_ns(Math.max(getEndTime(), res.getEndTime()));
setLatency(getLatency()+ res.getLatency());
setConnectTime(getConnectTime()+ res.getConnectTime());
setLatency_ns(getLatency()+ res.getLatency());
setConnectTime_ns(getConnectTime()+ res.getConnectTime());
elapsed += res.getTime();
}

View File

@ -85,12 +85,14 @@ public final class CSVSaveService {
public static final String SUCCESSFUL = "success"; // $NON-NLS-1$
public static final String THREAD_NAME = "threadName"; // $NON-NLS-1$
public static final String TIME_STAMP = "timeStamp"; // $NON-NLS-1$
public static final String TIME_STAMP_NS = "timeStamp_ns"; // $NON-NLS-1$
// ---------------------------------------------------------------------
// ADDITIONAL CSV RESULT FILE CONSTANTS AND FIELD NAME CONSTANTS
// ---------------------------------------------------------------------
public static final String CSV_ELAPSED = "elapsed"; // $NON-NLS-1$
public static final String CSV_ELAPSED_NS = "elapsed_ns"; // $NON-NLS-1$
public static final String CSV_BYTES = "bytes"; // $NON-NLS-1$
public static final String CSV_SENT_BYTES = "sentBytes"; // $NON-NLS-1$
public static final String CSV_THREAD_COUNT1 = "grpThreads"; // $NON-NLS-1$
@ -100,10 +102,13 @@ public final class CSVSaveService {
public static final String CSV_URL = "URL"; // $NON-NLS-1$
public static final String CSV_FILENAME = "Filename"; // $NON-NLS-1$
public static final String CSV_LATENCY = "Latency"; // $NON-NLS-1$
public static final String CSV_LATENCY_NS = "Latency_ns"; // $NON-NLS-1$
public static final String CSV_CONNECT_TIME = "Connect"; // $NON-NLS-1$
public static final String CSV_CONNECT_TIME_NS = "Connect_ns"; // $NON-NLS-1$
public static final String CSV_ENCODING = "Encoding"; // $NON-NLS-1$
public static final String CSV_HOSTNAME = "Hostname"; // $NON-NLS-1$
public static final String CSV_IDLETIME = "IdleTime"; // $NON-NLS-1$
public static final String CSV_IDLETIME_NS = "IdleTime_ns"; // $NON-NLS-1$
// Used to enclose variable name labels, to distinguish from any of the
// above labels
@ -228,10 +233,10 @@ public final class CSVSaveService {
Arrays.asList(DATE_FORMAT_STRINGS));
boolean foundMatch = false;
for(String fmt : DATE_FORMAT_STRINGS) {
SimpleDateFormat dateFormat = new SimpleDateFormat(fmt);
var dateFormat = new SimpleDateFormat(fmt);
dateFormat.setLenient(false);
try {
Date stamp = dateFormat.parse(text);
var stamp = dateFormat.parse(text);
timeStamp = stamp.getTime();
log.warn("Setting date format to: {}", fmt);
saveConfig.setDateFormat(fmt);
@ -245,9 +250,21 @@ public final class CSVSaveService {
throw new ParseException("No date-time format found matching "+text,-1);
}
}
try {
timeStamp = Long.parseLong(parts[i++]);
} catch (NumberFormatException e) {
i--;
timeStamp *= 100000L;
}
} else if (saveConfig.strictDateFormatter() != null) {
Date stamp = saveConfig.strictDateFormatter().parse(text);
var stamp = saveConfig.strictDateFormatter().parse(text);
timeStamp = stamp.getTime();
try {
timeStamp = Long.parseLong(parts[i++]);
} catch (NumberFormatException e) {
i--;
timeStamp *= 100000L;
}
} else { // can this happen?
final String msg = "Unknown timestamp format";
log.warn(msg);
@ -259,14 +276,22 @@ public final class CSVSaveService {
field = CSV_ELAPSED;
text = parts[i++];
elapsed = Long.parseLong(text);
try {
elapsed = Long.parseLong(parts[i++]);
} catch (NumberFormatException e) {
i--;
elapsed *= 100000L;
}
}
if (saveConfig.saveSampleCount()) {
@SuppressWarnings("deprecation")
StatisticalSampleResult sampleResult = new StatisticalSampleResult(timeStamp, elapsed);
StatisticalSampleResult sampleResult = new StatisticalSampleResult(elapsed);
sampleResult.setStampAndTime_ns(timeStamp, elapsed);
result = sampleResult;
} else {
result = new SampleResult(timeStamp, elapsed);
result = new SampleResult();
result.setStampAndTime_ns(timeStamp, elapsed);
}
if (saveConfig.saveLabel()) {
@ -345,6 +370,11 @@ public final class CSVSaveService {
field = CSV_LATENCY;
text = parts[i++];
result.setLatency(Long.parseLong(text));
try {
result.setLatency_ns(Long.parseLong(parts[i++]));
} catch (NumberFormatException e) {
i--;
}
}
if (saveConfig.saveEncoding()) {
@ -371,11 +401,21 @@ public final class CSVSaveService {
field = CSV_IDLETIME;
text = parts[i++];
result.setIdleTime(Long.parseLong(text));
try {
result.setIdleTime_ns(Long.parseLong(parts[i++]));
} catch (NumberFormatException e) {
i--;
}
}
if (saveConfig.saveConnectTime()) {
field = CSV_CONNECT_TIME;
text = parts[i++];
result.setConnectTime(Long.parseLong(text));
try {
result.setConnectTime_ns(Long.parseLong(parts[i++]));
} catch (NumberFormatException e) {
i--;
}
}
if (i + saveConfig.getVarCount() < parts.length) {
@ -416,8 +456,8 @@ public final class CSVSaveService {
StringBuilder text = new StringBuilder();
String delim = saveConfig.getDelimiter();
appendFields(saveConfig.saveTimestamp(), text, delim, TIME_STAMP);
appendFields(saveConfig.saveTime(), text, delim, CSV_ELAPSED);
appendFields(saveConfig.saveTimestamp(), text, delim, TIME_STAMP, TIME_STAMP_NS);
appendFields(saveConfig.saveTime(), text, delim, CSV_ELAPSED, CSV_ELAPSED_NS);
appendFields(saveConfig.saveLabel(), text, delim, LABEL);
appendFields(saveConfig.saveCode(), text, delim, RESPONSE_CODE);
appendFields(saveConfig.saveMessage(), text, delim, RESPONSE_MESSAGE);
@ -430,12 +470,12 @@ public final class CSVSaveService {
appendFields(saveConfig.saveThreadCounts(), text, delim, CSV_THREAD_COUNT1, CSV_THREAD_COUNT2);
appendFields(saveConfig.saveUrl(), text, delim, CSV_URL);
appendFields(saveConfig.saveFileName(), text, delim, CSV_FILENAME);
appendFields(saveConfig.saveLatency(), text, delim, CSV_LATENCY);
appendFields(saveConfig.saveLatency(), text, delim, CSV_LATENCY, CSV_LATENCY_NS);
appendFields(saveConfig.saveEncoding(), text, delim, CSV_ENCODING);
appendFields(saveConfig.saveSampleCount(), text, delim, CSV_SAMPLE_COUNT, CSV_ERROR_COUNT);
appendFields(saveConfig.saveHostname(), text, delim, CSV_HOSTNAME);
appendFields(saveConfig.saveIdleTime(), text, delim, CSV_IDLETIME);
appendFields(saveConfig.saveConnectTime(), text, delim, CSV_CONNECT_TIME);
appendFields(saveConfig.saveIdleTime(), text, delim, CSV_IDLETIME, CSV_IDLETIME_NS);
appendFields(saveConfig.saveConnectTime(), text, delim, CSV_CONNECT_TIME, CSV_CONNECT_TIME_NS);
for (int i = 0; i < SampleEvent.getVarCount(); i++) {
text.append(VARIABLE_NAME_QUOTE_CHAR);
@ -473,7 +513,9 @@ public final class CSVSaveService {
static {
headerLabelMethods.put(TIME_STAMP, new Functor("setTimestamp"));
headerLabelMethods.put(TIME_STAMP_NS, new Functor("setTimestamp"));
headerLabelMethods.put(CSV_ELAPSED, new Functor("setTime"));
headerLabelMethods.put(CSV_ELAPSED_NS, new Functor("setTime"));
headerLabelMethods.put(LABEL, new Functor("setLabel"));
headerLabelMethods.put(RESPONSE_CODE, new Functor("setCode"));
headerLabelMethods.put(RESPONSE_MESSAGE, new Functor("setMessage"));
@ -493,6 +535,7 @@ public final class CSVSaveService {
headerLabelMethods.put(CSV_URL, new Functor("setUrl"));
headerLabelMethods.put(CSV_FILENAME, new Functor("setFileName"));
headerLabelMethods.put(CSV_LATENCY, new Functor("setLatency"));
headerLabelMethods.put(CSV_LATENCY_NS, new Functor("setLatency"));
headerLabelMethods.put(CSV_ENCODING, new Functor("setEncoding"));
// Both these are needed in the list even though they set the same
// variable
@ -500,7 +543,9 @@ public final class CSVSaveService {
headerLabelMethods.put(CSV_ERROR_COUNT, new Functor("setSampleCount"));
headerLabelMethods.put(CSV_HOSTNAME, new Functor("setHostname"));
headerLabelMethods.put(CSV_IDLETIME, new Functor("setIdleTime"));
headerLabelMethods.put(CSV_IDLETIME_NS, new Functor("setIdleTime"));
headerLabelMethods.put(CSV_CONNECT_TIME, new Functor("setConnectTime"));
headerLabelMethods.put(CSV_CONNECT_TIME_NS, new Functor("setConnectTime"));
}
/**
@ -851,15 +896,17 @@ public final class CSVSaveService {
StringQuoter text = new StringQuoter(delimiter.charAt(0));
if (saveConfig.saveTimestamp()) {
if (saveConfig.printMilliseconds()) {
text.append(sample.getTimeStamp() / 1000000L);
text.append(sample.getTimeStamp());
} else if (saveConfig.threadSafeLenientFormatter() != null) {
String stamp = saveConfig.threadSafeLenientFormatter().format(
new Date(sample.getTimeStamp()));
new Date(sample.getTimeStamp() / 1000000L));
text.append(stamp);
}
}
if (saveConfig.saveTime()) {
text.append(sample.getTime() / 1000000L);
text.append(sample.getTime());
}
@ -918,6 +965,7 @@ public final class CSVSaveService {
}
if (saveConfig.saveLatency()) {
text.append(sample.getLatency() / 1000000L);
text.append(sample.getLatency());
}
@ -936,10 +984,12 @@ public final class CSVSaveService {
}
if (saveConfig.saveIdleTime()) {
text.append(sample.getIdleTime() / 1000000L);
text.append(sample.getIdleTime());
}
if (saveConfig.saveConnectTime()) {
text.append(sample.getConnectTime() / 1000000L);
text.append(sample.getConnectTime());
}

View File

@ -72,7 +72,9 @@ public class SampleResultConverter extends AbstractCollectionConverter {
private static final String ATT_HOSTNAME = "hn"; //$NON-NLS-1$
private static final String ATT_LABEL = "lb"; //$NON-NLS-1$
private static final String ATT_LATENCY = "lt"; //$NON-NLS-1$
private static final String ATT_LATENCY_NS = "lt_ns"; //$NON-NLS-1$
private static final String ATT_CONNECT_TIME = "ct"; //$NON-NLS-1$
private static final String ATT_CONNECT_TIME_NS = "ct_ns"; //$NON-NLS-1$
private static final String ATT_ALL_THRDS = "na"; //$NON-NLS-1$
private static final String ATT_GRP_THRDS = "ng"; //$NON-NLS-1$
@ -87,9 +89,12 @@ public class SampleResultConverter extends AbstractCollectionConverter {
private static final String ATT_SUCCESS = "s"; //$NON-NLS-1$
private static final String ATT_SAMPLE_COUNT = "sc"; //$NON-NLS-1$
private static final String ATT_TIME = "t"; //$NON-NLS-1$
private static final String ATT_TIME_NS = "t_ns"; //$NON-NLS-1$
private static final String ATT_IDLETIME = "it"; //$NON-NLS-1$
private static final String ATT_IDLETIME_NS = "it_ns"; //$NON-NLS-1$
private static final String ATT_THREADNAME = "tn"; //$NON-NLS-1$
private static final String ATT_TIME_STAMP = "ts"; //$NON-NLS-1$
private static final String ATT_TIME_STAMP_NS = "ts_ns"; //$NON-NLS-1$
/**
* Returns the converter version; used to check for possible
@ -281,19 +286,24 @@ public class SampleResultConverter extends AbstractCollectionConverter {
protected void setAttributes(HierarchicalStreamWriter writer, MarshallingContext context, SampleResult res,
SampleSaveConfiguration save) {
if (save.saveTime()) {
writer.addAttribute(ATT_TIME, Long.toString(res.getTime()));
writer.addAttribute(ATT_TIME, Long.toString(res.getTime() / 1000000L));
writer.addAttribute(ATT_TIME_NS, Long.toString(res.getTime()));
}
if (save.saveIdleTime()) {
writer.addAttribute(ATT_IDLETIME, Long.toString(res.getIdleTime()));
writer.addAttribute(ATT_IDLETIME, Long.toString(res.getIdleTime() / 1000000L));
writer.addAttribute(ATT_IDLETIME_NS, Long.toString(res.getIdleTime()));
}
if (save.saveLatency()) {
writer.addAttribute(ATT_LATENCY, Long.toString(res.getLatency()));
writer.addAttribute(ATT_LATENCY, Long.toString(res.getLatency() / 1000000L));
writer.addAttribute(ATT_LATENCY_NS, Long.toString(res.getLatency()));
}
if (save.saveConnectTime()) {
writer.addAttribute(ATT_CONNECT_TIME, Long.toString(res.getConnectTime()));
writer.addAttribute(ATT_CONNECT_TIME, Long.toString(res.getConnectTime() / 1000000L));
writer.addAttribute(ATT_CONNECT_TIME_NS, Long.toString(res.getConnectTime()));
}
if (save.saveTimestamp()) {
writer.addAttribute(ATT_TIME_STAMP, Long.toString(res.getTimeStamp()));
writer.addAttribute(ATT_TIME_STAMP, Long.toString(res.getTimeStamp() / 1000000L));
writer.addAttribute(ATT_TIME_STAMP_NS, Long.toString(res.getTimeStamp()));
}
if (save.saveSuccess()) {
writer.addAttribute(ATT_SUCCESS, Boolean.toString(res.isSuccessful()));
@ -441,11 +451,28 @@ public class SampleResultConverter extends AbstractCollectionConverter {
res.setResponseMessage(ConversionHelp.decode(reader.getAttribute(ATT_RESPONSE_MESSAGE)));
res.setSuccessful(Converter.getBoolean(reader.getAttribute(ATT_SUCCESS), true));
res.setThreadName(ConversionHelp.decode(reader.getAttribute(ATT_THREADNAME)));
res.setStampAndTime(Converter.getLong(reader.getAttribute(ATT_TIME_STAMP)),
Converter.getLong(reader.getAttribute(ATT_TIME)));
res.setIdleTime(Converter.getLong(reader.getAttribute(ATT_IDLETIME)));
res.setLatency(Converter.getLong(reader.getAttribute(ATT_LATENCY)));
res.setConnectTime(Converter.getLong(reader.getAttribute(ATT_CONNECT_TIME)));
if (reader.getAttribute(ATT_TIME_STAMP_NS) != null && reader.getAttribute(ATT_TIME_NS) != null) {
res.setStampAndTime_ns(Converter.getLong(reader.getAttribute(ATT_TIME_STAMP_NS)),
Converter.getLong(reader.getAttribute(ATT_TIME_NS)));
} else {
res.setStampAndTime(Converter.getLong(reader.getAttribute(ATT_TIME_STAMP)),
Converter.getLong(reader.getAttribute(ATT_TIME)));
}
if (reader.getAttribute(ATT_IDLETIME_NS) != null) {
res.setIdleTime_ns(Converter.getLong(reader.getAttribute(ATT_IDLETIME_NS)));
} else {
res.setIdleTime(Converter.getLong(reader.getAttribute(ATT_IDLETIME)));
}
if (reader.getAttribute(ATT_LATENCY_NS) != null) {
res.setLatency_ns(Converter.getLong(reader.getAttribute(ATT_LATENCY_NS)));
} else {
res.setLatency(Converter.getLong(reader.getAttribute(ATT_LATENCY)));
}
if (reader.getAttribute(ATT_CONNECT_TIME_NS) != null) {
res.setConnectTime_ns(Converter.getLong(reader.getAttribute(ATT_CONNECT_TIME_NS)));
} else {
res.setConnectTime(Converter.getLong(reader.getAttribute(ATT_CONNECT_TIME)));
}
res.setBytes(Converter.getLong(reader.getAttribute(ATT_BYTES)));
res.setSentBytes(Converter.getLong(reader.getAttribute(ATT_SENT_BYTES)));
res.setSampleCount(Converter.getInt(reader.getAttribute(ATT_SAMPLE_COUNT),1)); // default is 1

View File

@ -84,23 +84,14 @@ public class SampleSaveConfigurationConverter extends ReflectionConverter {
}
// These are new fields; not saved unless true
// This list MUST agree with the list in the marshall() method below
switch (fieldName) {
case NODE_BYTES:
case NODE_SENT_BYTES:
case NODE_URL:
case NODE_FILENAME:
case NODE_HOSTNAME:
case NODE_THREAD_COUNT:
case NODE_SAMPLE_COUNT:
case NODE_IDLE_TIME:
case NODE_CONNECT_TIME:
// The two fields below are not currently saved or restored
case NODE_DELIMITER:
case NODE_PRINTMS:
return false;
default:
return true;
}
return switch (fieldName) {
case NODE_BYTES, NODE_SENT_BYTES, NODE_URL, NODE_FILENAME,
NODE_HOSTNAME, NODE_THREAD_COUNT, NODE_SAMPLE_COUNT,
NODE_IDLE_TIME, NODE_CONNECT_TIME,
// The two fields below are not currently saved or restored
NODE_DELIMITER, NODE_PRINTMS -> false;
default -> true;
};
}
}

View File

@ -174,18 +174,18 @@ public class TestBeanHelper {
private static Object unwrapProperty(PropertyDescriptor desc, JMeterProperty jprop, Class<?> type) {
Object value;
if(jprop instanceof TestElementProperty)
if(jprop instanceof TestElementProperty testElementProperty)
{
TestElement te = ((TestElementProperty)jprop).getElement();
TestElement te = testElementProperty.getElement();
if(te instanceof TestBean)
{
prepare(te);
}
value = te;
}
else if(jprop instanceof MultiProperty)
else if(jprop instanceof MultiProperty multiProperty)
{
value = unwrapCollection((MultiProperty)jprop,(String)desc.getValue(TableEditor.CLASSNAME));
value = unwrapCollection(multiProperty,(String)desc.getValue(TableEditor.CLASSNAME));
}
// value was not provided, and this is allowed
else if (jprop instanceof NullProperty &&
@ -200,10 +200,10 @@ public class TestBeanHelper {
private static Object unwrapCollection(MultiProperty prop, String type)
{
if(prop instanceof CollectionProperty)
if(prop instanceof CollectionProperty collectionProperty)
{
Collection<Object> values = new ArrayList<>();
for (JMeterProperty jMeterProperty : prop) {
for (JMeterProperty jMeterProperty : collectionProperty) {
try {
values.add(unwrapProperty(null, jMeterProperty, Class.forName(type)));
}

View File

@ -236,9 +236,9 @@ public abstract class AbstractTestElement implements TestElement, Serializable,
*/
@Override
public boolean equals(Object o) {
if (o instanceof AbstractTestElement) {
if (o instanceof AbstractTestElement other) {
try (ResourceLock ignored = readLock()) {
return ((AbstractTestElement) o).propMap.equals(propMap);
return other.propMap.equals(propMap);
}
} else {
return false;

View File

@ -195,13 +195,12 @@ public abstract class AbstractProperty implements JMeterProperty {
*/
@Override
public boolean equals(Object o) {
if (!(o instanceof JMeterProperty)) {
if (!(o instanceof JMeterProperty jpo)) {
return false;
}
if (this == o) {
return true;
}
JMeterProperty jpo = (JMeterProperty) o;
if (!name.equals(jpo.getName())) {
return false;
}
@ -275,18 +274,18 @@ public abstract class AbstractProperty implements JMeterProperty {
if (item == null) {
return new NullProperty();
}
if (item instanceof String) {
return new StringProperty("", item.toString());
} else if (item instanceof Boolean) {
return new BooleanProperty("", (Boolean) item);
} else if (item instanceof Float) {
return new FloatProperty("", (Float) item);
} else if (item instanceof Double) {
return new DoubleProperty("", (Double) item);
} else if (item instanceof Integer) {
return new IntegerProperty("", (Integer) item);
} else if (item instanceof Long) {
return new LongProperty("", (Long) item);
if (item instanceof String str) {
return new StringProperty("", str);
} else if (item instanceof Boolean bool) {
return new BooleanProperty("", bool);
} else if (item instanceof Float floatVal) {
return new FloatProperty("", floatVal);
} else if (item instanceof Double doubleVal) {
return new DoubleProperty("", doubleVal);
} else if (item instanceof Integer intVal) {
return new IntegerProperty("", intVal);
} else if (item instanceof Long longVal) {
return new LongProperty("", longVal);
} else {
return new StringProperty("", item.toString());
}
@ -341,8 +340,8 @@ public abstract class AbstractProperty implements JMeterProperty {
Object key = entry.getKey();
Object prop = entry.getValue();
String item=null;
if (key instanceof String) {
item = (String) key;
if (key instanceof String keyStr) {
item = keyStr;
} else {
if (key != null) {
log.error("Expected key type String, found: {}", key.getClass());
@ -378,18 +377,17 @@ public abstract class AbstractProperty implements JMeterProperty {
* @return the JMeterProperty
*/
protected static JMeterProperty makeProperty(Object item) {
if (item instanceof JMeterProperty) {
return (JMeterProperty) item;
if (item instanceof JMeterProperty prop) {
return prop;
}
if (item instanceof TestElement) {
return new TestElementProperty(((TestElement) item).getName(),
(TestElement) item);
if (item instanceof TestElement testElement) {
return new TestElementProperty(testElement.getName(), testElement);
}
if (item instanceof Collection<?>) {
return new CollectionProperty(Integer.toString(item.hashCode()), (Collection<?>) item);
if (item instanceof Collection<?> collection) {
return new CollectionProperty(Integer.toString(item.hashCode()), collection);
}
if (item instanceof Map<?, ?>) {
return new MapProperty(Integer.toString(item.hashCode()), (Map<?, ?>) item);
if (item instanceof Map<?, ?> map) {
return new MapProperty(Integer.toString(item.hashCode()), map);
}
return null;
}

View File

@ -66,27 +66,27 @@ public class CollectionProperty extends MultiProperty {
}
public void set(int index, String prop) {
if (value instanceof List<?>) {
((List<JMeterProperty>) value).set(index, new StringProperty(prop, prop));
if (value instanceof List<JMeterProperty> list) {
list.set(index, new StringProperty(prop, prop));
}
}
public void set(int index, JMeterProperty prop) {
if (value instanceof List<?>) {
((List<JMeterProperty>) value).set(index, prop);
if (value instanceof List<JMeterProperty> list) {
list.set(index, prop);
}
}
public JMeterProperty get(int row) {
if (value instanceof List<?>) {
return ((List<JMeterProperty>) value).get(row);
if (value instanceof List<JMeterProperty> list) {
return list.get(row);
}
return null;
}
public void remove(int index) {
if (value instanceof List<?>) {
((List<?>) value).remove(index);
if (value instanceof List<?> list) {
list.remove(index);
}
}

View File

@ -355,8 +355,8 @@ public class JMeterThread implements Runnable, Interruptible {
private void triggerLoopLogicalActionOnParentControllers(Sampler sampler, JMeterContext threadContext,
Consumer<? super FindTestElementsUpToRootTraverser> consumer) {
TransactionSampler transactionSampler = null;
if (sampler instanceof TransactionSampler) {
transactionSampler = (TransactionSampler) sampler;
if (sampler instanceof TransactionSampler transSampler) {
transactionSampler = transSampler;
}
Sampler realSampler = findRealSampler(sampler);
@ -389,11 +389,10 @@ public class JMeterThread implements Runnable, Interruptible {
private static void continueOnCurrentLoop(FindTestElementsUpToRootTraverser pathToRootTraverser) {
List<Controller> controllersToReinit = pathToRootTraverser.getControllersToRoot();
for (Controller parentController : controllersToReinit) {
if (parentController instanceof AbstractThreadGroup) {
AbstractThreadGroup tg = (AbstractThreadGroup) parentController;
if (parentController instanceof AbstractThreadGroup tg) {
tg.startNextLoop();
} else if (parentController instanceof IteratingController) {
((IteratingController) parentController).startNextLoop();
} else if (parentController instanceof IteratingController iterController) {
iterController.startNextLoop();
break;
} else {
parentController.triggerEndOfLoop();
@ -409,11 +408,10 @@ public class JMeterThread implements Runnable, Interruptible {
private static void breakOnCurrentLoop(FindTestElementsUpToRootTraverser pathToRootTraverser) {
List<Controller> controllersToReinit = pathToRootTraverser.getControllersToRoot();
for (Controller parentController : controllersToReinit) {
if (parentController instanceof AbstractThreadGroup) {
AbstractThreadGroup tg = (AbstractThreadGroup) parentController;
if (parentController instanceof AbstractThreadGroup tg) {
tg.breakThreadLoop();
} else if (parentController instanceof IteratingController) {
((IteratingController) parentController).breakLoop();
} else if (parentController instanceof IteratingController iterController) {
iterController.breakLoop();
break;
} else {
parentController.triggerEndOfLoop();
@ -448,8 +446,8 @@ public class JMeterThread implements Runnable, Interruptible {
*/
private static Sampler findRealSampler(Sampler sampler) {
Sampler realSampler = sampler;
while (realSampler instanceof TransactionSampler) {
realSampler = ((TransactionSampler) realSampler).getSubSampler();
while (realSampler instanceof TransactionSampler transSampler) {
realSampler = transSampler.getSubSampler();
}
return realSampler;
}
@ -469,8 +467,8 @@ public class JMeterThread implements Runnable, Interruptible {
// Find the package for the transaction
SamplePackage transactionPack = null;
try {
if (current instanceof TransactionSampler) {
transactionSampler = (TransactionSampler) current;
if (current instanceof TransactionSampler transSampler) {
transactionSampler = transSampler;
transactionPack = compiler.configureTransactionSampler(transactionSampler);
// Check if the transaction is done
@ -641,8 +639,8 @@ public class JMeterThread implements Runnable, Interruptible {
currentSamplerForInterruption = sampler;
if (!sampleMonitors.isEmpty()) {
for (SampleMonitor sampleMonitor : sampleMonitors) {
if(sampleMonitor instanceof TestElement) {
TestBeanHelper.prepare((TestElement) sampleMonitor);
if(sampleMonitor instanceof TestElement testElement) {
TestBeanHelper.prepare(testElement);
}
sampleMonitor.sampleStarting(sampler);
}
@ -795,8 +793,7 @@ public class JMeterThread implements Runnable, Interruptible {
@Override
public void addNode(Object node, HashTree subTree) {
if (node instanceof ThreadListener) {
ThreadListener tl = (ThreadListener) node;
if (node instanceof ThreadListener tl) {
if (isStart) {
try {
tl.threadStarted();
@ -902,8 +899,7 @@ public class JMeterThread implements Runnable, Interruptible {
private static void checkAssertions(List<? extends Assertion> assertions, SampleResult parent, JMeterContext threadContext) {
for (Assertion assertion : assertions) {
TestBeanHelper.prepare((TestElement) assertion);
if (assertion instanceof AbstractScopedAssertion) {
AbstractScopedAssertion scopedAssertion = (AbstractScopedAssertion) assertion;
if (assertion instanceof AbstractScopedAssertion scopedAssertion) {
String scope = scopedAssertion.fetchScope();
if (scopedAssertion.isScopeParent(scope)
|| scopedAssertion.isScopeAll(scope)
@ -1031,8 +1027,8 @@ public class JMeterThread implements Runnable, Interruptible {
threadVars.incIteration();
for (TestIterationListener listener : testIterationStartListeners) {
listener.testIterationStart(new LoopIterationEvent(threadGroupLoopController, threadVars.getIteration()));
if (listener instanceof TestElement) {
((TestElement) listener).recoverRunningVersion();
if (listener instanceof TestElement testElement) {
testElement.recoverRunningVersion();
}
}
}

View File

@ -136,11 +136,11 @@ public class TestCompiler implements HashTreeTraverser {
}
TestElement child = stack.getLast();
trackIterationListeners(stack);
if (child instanceof Sampler) {
saveSamplerConfigs((Sampler) child);
if (child instanceof Sampler sampler) {
saveSamplerConfigs(sampler);
}
else if(child instanceof TransactionController) {
saveTransactionControllerConfigs((TransactionController) child);
else if(child instanceof TransactionController transactionController) {
saveTransactionControllerConfigs(transactionController);
}
stack.removeLast();
if (!stack.isEmpty()) {
@ -148,8 +148,7 @@ public class TestCompiler implements HashTreeTraverser {
boolean duplicate = false;
// Bug 53750: this condition used to be in ObjectPair#addTestElements()
if (parent instanceof Controller && (child instanceof Sampler || child instanceof Controller)) {
if (parent instanceof TestCompilerHelper) {
TestCompilerHelper te = (TestCompilerHelper) parent;
if (parent instanceof TestCompilerHelper te) {
duplicate = !te.addTestElementOnce(child);
} else { // this is only possible for 3rd party controllers by default
ObjectPair pair = new ObjectPair(child, parent);
@ -174,16 +173,16 @@ public class TestCompiler implements HashTreeTraverser {
@SuppressWarnings("NonApiType")
private static void trackIterationListeners(LinkedList<TestElement> pStack) {
TestElement child = pStack.getLast();
if (child instanceof LoopIterationListener) {
if (child instanceof LoopIterationListener loopListener) {
ListIterator<TestElement> iter = pStack.listIterator(pStack.size());
while (iter.hasPrevious()) {
TestElement item = iter.previous();
if (item == child) {
continue;
}
if (item instanceof Controller) {
if (item instanceof Controller controller) {
TestBeanHelper.prepare(child);
((Controller) item).addIterationListener((LoopIterationListener) child);
controller.addIterationListener(loopListener);
break;
}
}
@ -209,23 +208,23 @@ public class TestCompiler implements HashTreeTraverser {
List<PostProcessor> tempPost = new ArrayList<>();
List<Assertion> tempAssertions = new ArrayList<>();
for (Object item : testTree.list(stack.subList(0, i))) {
if (item instanceof ConfigTestElement) {
configs.add((ConfigTestElement) item);
if (item instanceof ConfigTestElement configElement) {
configs.add(configElement);
}
if (item instanceof SampleListener) {
listeners.add((SampleListener) item);
if (item instanceof SampleListener listener) {
listeners.add(listener);
}
if (item instanceof Timer) {
timers.add((Timer) item);
if (item instanceof Timer timer) {
timers.add(timer);
}
if (item instanceof Assertion) {
tempAssertions.add((Assertion) item);
if (item instanceof Assertion assertion) {
tempAssertions.add(assertion);
}
if (item instanceof PostProcessor) {
tempPost.add((PostProcessor) item);
if (item instanceof PostProcessor postProcessor) {
tempPost.add(postProcessor);
}
if (item instanceof PreProcessor) {
tempPre.add((PreProcessor) item);
if (item instanceof PreProcessor preProcessor) {
tempPre.add(preProcessor);
}
}
assertions.addAll(0, tempAssertions);
@ -251,11 +250,11 @@ public class TestCompiler implements HashTreeTraverser {
for (int i = stack.size(); i > 0; i--) {
addDirectParentControllers(controllers, stack.get(i - 1));
for (Object item : testTree.list(stack.subList(0, i))) {
if (item instanceof SampleListener) {
listeners.add((SampleListener) item);
if (item instanceof SampleListener listener) {
listeners.add(listener);
}
if (item instanceof Assertion) {
assertions.add((Assertion) item);
if (item instanceof Assertion assertion) {
assertions.add(assertion);
}
}
}
@ -272,9 +271,9 @@ public class TestCompiler implements HashTreeTraverser {
* @param maybeController
*/
private static void addDirectParentControllers(List<? super Controller> controllers, TestElement maybeController) {
if (maybeController instanceof Controller) {
if (maybeController instanceof Controller controller) {
log.debug("adding controller: {} to sampler config", maybeController);
controllers.add((Controller) maybeController);
controllers.add(controller);
}
}
@ -297,8 +296,8 @@ public class TestCompiler implements HashTreeTraverser {
/** {@inheritDoc} */
@Override
public boolean equals(Object o) {
if (o instanceof ObjectPair) {
return child == ((ObjectPair) o).child && parent == ((ObjectPair) o).parent;
if (o instanceof ObjectPair other) {
return child == other.child && parent == other.parent;
}
return false;
}
@ -309,8 +308,8 @@ public class TestCompiler implements HashTreeTraverser {
for (ConfigTestElement config : configs) {
if (!(config instanceof NoConfigMerge))
{
if(sam instanceof ConfigMergabilityIndicator) {
if(((ConfigMergabilityIndicator)sam).applies(config)) {
if(sam instanceof ConfigMergabilityIndicator indicator) {
if(indicator.applies(config)) {
sam.addTestElement(config);
}
} else {

View File

@ -17,11 +17,14 @@
package org.apache.jmeter.util;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.DoubleAdder;
import java.util.concurrent.atomic.LongAccumulator;
import java.util.concurrent.atomic.LongAdder;
import org.apache.jmeter.report.config.ReportGeneratorConfiguration;
import org.apache.jmeter.samplers.SampleResult;
/**
@ -35,9 +38,9 @@ import org.apache.jmeter.samplers.SampleResult;
*/
public class Calculator {
private final DoubleAdder sum = new DoubleAdder();
private BigDecimal sum = BigDecimal.ZERO;
private final DoubleAdder sumOfSquares = new DoubleAdder();
private BigDecimal sumOfSquares = BigDecimal.ZERO;
private final LongAdder count = new LongAdder();
@ -69,8 +72,8 @@ public class Calculator {
public void clear() {
maximum.set(Long.MIN_VALUE);
minimum.set(Long.MAX_VALUE);
sum.reset();
sumOfSquares.reset();
sum = BigDecimal.ZERO;
sumOfSquares = BigDecimal.ZERO;
count.reset();
bytes.reset();
sentBytes.reset();
@ -88,7 +91,7 @@ public class Calculator {
*/
private void addValue(long newValue, int sampleCount) {
count.add(sampleCount);
sum.add((double) newValue);
sum = sum.add(BigDecimal.valueOf(newValue));
long value;
double extraSumOfSquares;
if (sampleCount > 1) {
@ -100,7 +103,7 @@ public class Calculator {
value = newValue;
extraSumOfSquares = (double) newValue * (double) newValue;
}
sumOfSquares.add(extraSumOfSquares);
sumOfSquares = sumOfSquares.add(BigDecimal.valueOf(extraSumOfSquares));
long currentMinimum = minimum.get();
if (currentMinimum > value) {
@ -155,12 +158,11 @@ public class Calculator {
public double getMean() {
double sum = this.sum.sum();
double count = this.count.sum();
if (count == 0) {
return 0.0;
}
return sum / count;
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? sum.divide(BigDecimal.valueOf(count), 16, RoundingMode.HALF_UP).divide(BigDecimal.valueOf(1000000L), 16, RoundingMode.HALF_UP).doubleValue() : sum.divide(BigDecimal.valueOf(count), 16, RoundingMode.HALF_UP).doubleValue();
}
public Number getMeanAsNumber() {
@ -169,23 +171,20 @@ public class Calculator {
}
public double getStandardDeviation() {
double sum = this.sum.sum();
double sumOfSquares = this.sumOfSquares.sum();
double count = this.count.sum();
// Just in case
if (count == 0) {
return 0.0;
}
double mean = sum / count;
return Math.sqrt((sumOfSquares / count) - (mean * mean));
return Math.sqrt(sumOfSquares.divide(BigDecimal.valueOf(count), 16, RoundingMode.HALF_UP).subtract(sum.divide(BigDecimal.valueOf(count), 16, RoundingMode.HALF_UP).pow(2)).doubleValue());
}
public long getMin() {
return minimum.get();
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? minimum.get() / 1000000L : minimum.get();
}
public long getMax() {
return maximum.get();
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? maximum.get() / 1000000L : maximum.get();
}
public int getCount() {
@ -286,7 +285,7 @@ public class Calculator {
private double getRatePerSecond(long value) {
long elapsedTime = this.elapsedTime.get();
if (elapsedTime > 0) {
return value / ((double) elapsedTime / 1000); // 1000 = millisecs/sec
return value / (elapsedTime / 1000000.0D / 1000.0D); // 1000 = millisecs/sec
}
return 0.0;
}

View File

@ -17,8 +17,10 @@
package org.apache.jmeter.visualizers;
import java.math.BigInteger;
import java.text.DecimalFormat;
import org.apache.jmeter.report.config.ReportGeneratorConfiguration;
import org.apache.jmeter.samplers.SampleResult;
/**
@ -43,7 +45,7 @@ public class RunningSample {
private long counter;
private long runningSum;
private BigInteger runningSum;
private long max;
@ -91,7 +93,7 @@ public class RunningSample {
private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final)
counter = 0L;
runningSum = 0L;
runningSum = BigInteger.ZERO;
max = Long.MIN_VALUE;
min = Long.MAX_VALUE;
errorCount = 0L;
@ -138,7 +140,7 @@ public class RunningSample {
return Double.MAX_VALUE;
}
return (double) counter / howLongRunning * 1000.0;
return (double) counter / (howLongRunning / 100000.0D / 1000.0D);
}
/**
@ -232,7 +234,7 @@ public class RunningSample {
if (lastTime < endTime) {
lastTime = endTime;
}
runningSum += aTimeInMillis;
runningSum = runningSum.add(BigInteger.valueOf(aTimeInMillis));
if (aTimeInMillis > max) {
max = aTimeInMillis;
@ -253,7 +255,7 @@ public class RunningSample {
public void addSample(RunningSample rs) {
this.counter += rs.counter;
this.errorCount += rs.errorCount;
this.runningSum += rs.runningSum;
runningSum = runningSum.add(rs.runningSum);
if (this.firstTime > rs.firstTime) {
this.firstTime = rs.firstTime;
}
@ -305,7 +307,7 @@ public class RunningSample {
if (counter == 0) {
return 0;
}
return runningSum / counter;
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? runningSum.divide(BigInteger.valueOf(counter)).divide(BigInteger.valueOf(1000000L)).longValue() : runningSum.divide(BigInteger.valueOf(counter)).longValue();
}
/**

View File

@ -210,6 +210,6 @@ public class Sample implements Serializable, Comparable<Sample> {
*/
@SuppressWarnings("JavaUtilDate")
public String getStartTimeFormatted(Format format) {
return format.format(new Date(getStartTime()));
return format.format(new Date(getStartTime() / 1000000L));
}
}

View File

@ -17,8 +17,10 @@
package org.apache.jmeter.visualizers;
import java.math.BigInteger;
import java.util.Map;
import org.apache.jmeter.report.config.ReportGeneratorConfiguration;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jorphan.math.StatCalculatorLong;
@ -74,7 +76,7 @@ public class SamplingStatCalculator {
if (getCurrentSample().getEndTime() == 0) {
return 0;// No samples collected ...
}
return getCurrentSample().getEndTime() - firstTime;
return (getCurrentSample().getEndTime() - firstTime) / 1000000L;
}
/**
@ -190,16 +192,16 @@ public class SamplingStatCalculator {
eCount += res.getErrorCount();
endTime = getEndTime(res);
long howLongRunning = endTime - firstTime;
throughput = ((double) calculator.getCount() / (double) howLongRunning) * 1000.0;
throughput = (double) calculator.getCount() / (howLongRunning / 1000000.0D / 1000.0D);
if (throughput > maxThroughput) {
maxThroughput = throughput;
}
rtime = res.getTime();
cmean = (long)calculator.getMean();
cmean = ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? (long) calculator.getMean() / 1000000L : (long) calculator.getMean();
cstdv = (long)calculator.getStandardDeviation();
cmedian = calculator.getMedian();
cpercent = calculator.getPercentPoint(0.500);
cmedian = ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? calculator.getMedian().divide(BigInteger.valueOf(1000000L)).longValue() : calculator.getMedian().longValue();
cpercent = ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? calculator.getPercentPoint(0.500D).divide(BigInteger.valueOf(1000000L)).longValue() : calculator.getPercentPoint(0.500D).longValue();
// TODO cpercent is the same as cmedian here - why? and why pass it to "distributionLine"?
rbool = res.isSuccessful();
}
@ -273,7 +275,7 @@ public class SamplingStatCalculator {
}
public Number getPercentPoint(double percent) {
return calculator.getPercentPoint(percent);
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? calculator.getPercentPoint(percent).divide(BigInteger.valueOf(1000000L)) : calculator.getPercentPoint(percent);
}
public long getCount() {
@ -281,30 +283,30 @@ public class SamplingStatCalculator {
}
public Number getMax() {
return calculator.getMax();
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? calculator.getMax().divide(BigInteger.valueOf(1000000L)) : calculator.getMax();
}
public double getMean() {
return calculator.getMean();
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? calculator.getMean() / 1000000.0D : calculator.getMean();
}
public Number getMeanAsNumber() {
return (long) calculator.getMean();
return (long) getMean();
}
public Number getMedian() {
return calculator.getMedian();
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? calculator.getMedian().divide(BigInteger.valueOf(1000000L)) : calculator.getMedian();
}
public Number getMin() {
if (calculator.getMin() < 0) {
if (calculator.getMin().compareTo(BigInteger.valueOf(0L)) < 0) {
return 0L;
}
return calculator.getMin();
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? calculator.getMin().divide(BigInteger.valueOf(1000000L)) : calculator.getMin();
}
public Number getPercentPoint(float percent) {
return calculator.getPercentPoint(percent);
return ReportGeneratorConfiguration.jmeter_reportgenerator_ms_ns_isMs ? calculator.getPercentPoint(percent).divide(BigInteger.valueOf(1000000L)) : calculator.getPercentPoint(percent);
}
public double getStandardDeviation() {

View File

@ -109,7 +109,7 @@ public class TableSample implements Serializable, Comparable<TableSample> {
*/
@SuppressWarnings("JavaUtilDate")
public String getStartTimeFormatted(Format format) {
return format.format(new Date(getStartTime()));
return format.format(new Date(getStartTime() / 1000000L));
}
public String getThreadName() {

View File

@ -59,6 +59,7 @@ aggregate_graph_legend.placement.top=Top
aggregate_graph_legend_placement=Placement\:
aggregate_graph_max_length_xaxis_label=Max length of x-axis label\:
aggregate_graph_ms=Milliseconds
aggregate_graph_ns=Nanoseconds
aggregate_graph_no_values_to_graph=No values to graph
aggregate_graph_number_grouping=Show number grouping?
aggregate_graph_response_time=Response Time
@ -447,6 +448,7 @@ graph_results_deviation=Deviation
graph_results_latest_sample=Latest Sample
graph_results_median=Median
graph_results_ms=ms
graph_results_ns=ns
graph_results_no_samples=No of Samples
graph_results_throughput=Throughput
graph_results_title=Graph Results
@ -999,9 +1001,9 @@ reportgenerator_summary_total=Total
request_data=Request Data
reset=Reset
response_save_as_md5=Save response as MD5 hash?
response_time_distribution_satisfied_label=Requests having \nresponse time <= {0}ms
response_time_distribution_tolerated_label= Requests having \nresponse time > {0}ms and <= {1}ms
response_time_distribution_untolerated_label=Requests having \nresponse time > {0}ms
response_time_distribution_satisfied_label=Requests having \nresponse time <= {0}{1}
response_time_distribution_tolerated_label=Requests having \nresponse time > {0}{2} and <= {1}{2}
response_time_distribution_untolerated_label=Requests having \nresponse time > {0}{1}
response_time_distribution_failed_label=Requests in error
restart=Restart
restart_error=Restart error

View File

@ -74,7 +74,7 @@ class TestSampleResult implements JMeterSerialTest {
}
private static void assertAlmostEquals(long expected, long actual, long delta, String message) {
long actualDelta = Math.abs(expected - actual);
long actualDelta = Math.abs(expected - actual / 1000000L);
if (actualDelta > delta) {
Assertions.fail(() -> message + ", expected " + expected
+ " within delta of " + delta + ", but got " + actual
@ -277,7 +277,7 @@ class TestSampleResult implements JMeterSerialTest {
*/
long diff = parentElapsedTotal - sumSamplesTimes;
long maxDiff = nanoTime ? 10 : 16; // TimeMillis has granularity of 10-20
long maxDiff = nanoTime ? 10 * 1000000L : 16 * 1000000L; // TimeMillis has granularity of 10-20
if (diff < 0 || diff > maxDiff) {
Assertions.fail("ParentElapsed: " + parentElapsedTotal + " - " + " sum(samples): " + sumSamplesTimes
+ " => " + diff + " not in [0," + maxDiff + "]; nanotime=" + nanoTime);
@ -297,9 +297,9 @@ class TestSampleResult implements JMeterSerialTest {
calculator.addSample(parent);
Assertions.assertEquals(600, calculator.getTotalBytes());
Assertions.assertEquals(1, calculator.getCount());
Assertions.assertEquals(1d / (parentElapsedTotal / 1000d), calculator.getRate(), 0.0001d); // Allow for some margin of error
Assertions.assertEquals(1d / (parentElapsedTotal / 1000000.0D / 1000d), calculator.getRate(), 0.0001d); // Allow for some margin of error
// Check that the throughput uses the time elapsed for the sub results
Assertions.assertFalse(1d / (parentElapsed / 1000d) <= calculator.getRate());
Assertions.assertFalse(1d / (parentElapsed / 1000000.0D / 1000d) <= calculator.getRate());
}
// TODO some more invalid sequence tests needed

View File

@ -152,8 +152,8 @@ public class TestCSVSaveService extends JMeterTestCase {
// header text should not change unexpectedly
// if this test fails, check whether the default was intentionally changed or not
public void testHeader() {
final String HDR = "timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,"
+ "failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,IdleTime,Connect";
final String HDR = "timeStamp,timeStamp_ns,elapsed,elapsed_ns,label,responseCode,responseMessage,threadName,dataType,success,"
+ "failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,Latency_ns,IdleTime,IdleTime_ns,Connect,Connect_ns";
assertEquals(HDR, CSVSaveService.printableFieldNamesToString(), "Header text has changed");
}
@ -161,7 +161,7 @@ public class TestCSVSaveService extends JMeterTestCase {
// sample format should not change unexpectedly
// if this test fails, check whether the default was intentionally changed or not
public void testSample() throws MalformedURLException {
final String RESULT = "1,2,3,4,5,6,7,true,,8,9,10,11,https://jmeter.apache.org,12,13,14";
final String RESULT = "1,1000000,2,2000000,3,4,5,6,7,true,,8,9,10,11,https://jmeter.apache.org,12,12000000,13,13000000,14,14000000";
SampleResult result = new SampleResult();
result.setSaveConfig(new SampleSaveConfiguration());
result.setStampAndTime(1, 2);

View File

@ -28,7 +28,7 @@ class CalculatorTest {
@Test
fun min() {
assertEquals(Long.MAX_VALUE, calculator.min, "min()")
assertEquals(Long.MAX_VALUE / 1000000L, calculator.min, "min()")
calculator.addSample(SampleResult(10, 42))
assertEquals(42, calculator.min, "min(42)")
calculator.addSample(SampleResult(10, 40))
@ -41,7 +41,7 @@ class CalculatorTest {
@Test
fun max() {
assertEquals(Long.MIN_VALUE, calculator.max, "max()")
assertEquals(Long.MIN_VALUE / 1000000L, calculator.max, "max()")
calculator.addSample(SampleResult(10, 40))
assertEquals(40, calculator.max, "max(40)")
calculator.addSample(SampleResult(10, 42))
@ -80,18 +80,18 @@ class CalculatorTest {
calculator.addSample(SampleResult(10, 40))
assertEquals(0.0, calculator.standardDeviation, "standardDeviation(40)")
calculator.addSample(SampleResult(10, 42))
assertEquals(1.0, calculator.standardDeviation, "standardDeviation(40, 42)")
assertEquals(1000000.0, calculator.standardDeviation, "standardDeviation(40, 42)")
calculator.addSample(SampleResult(10, 43))
// Math.sqrt((sumOfSquares / count) - (mean * mean))
assertEquals(
sqrt((40 * 40 + 42 * 42 + 43 * 43) / 3.0 - ((40.0 + 42 + 43) / 3).pow(2)),
sqrt((40 * 1000000L * 40 * 1000000L + 42 * 1000000L * 42 * 1000000L + 43 * 1000000L * 43 * 1000000L) / 3.0 - ((40.0 * 1000000.0 + 42 * 1000000.0 + 43 * 1000000.0) / 3).pow(2)),
calculator.standardDeviation,
0.001,
"standardDeviation(40, 42, 43)"
)
calculator.addSample(SampleResult(10, 48).apply { sampleCount = 2 })
assertEquals(
sqrt((40 * 40 + 42 * 42 + 43 * 43 + 24 * 24 + 24 * 24) / 5.0 - ((40.0 + 42 + 43 + 24 + 24) / 5.0).pow(2)),
sqrt((40 * 1000000L * 40 * 1000000L + 42 * 1000000L * 42 * 1000000L + 43 * 1000000L * 43 * 1000000L + 24 * 1000000L * 24 * 1000000L + 24 * 1000000L * 24 * 1000000L) / 5.0 - ((40.0 * 1000000.0 + 42 * 1000000.0 + 43 * 1000000.0 + 24 * 1000000.0 + 24 * 1000000.0) / 5.0).pow(2)),
calculator.standardDeviation,
0.001,
"standardDeviation(40, 42, 43, 48/2)"

View File

@ -154,4 +154,16 @@ class HtmlReportGeneratorTest : JMeterTestCase() {
fail("First result message should contain '$expectedError', but was '$firstMessage'")
}
}
@Test
fun ns() {
val mapper = ObjectMapper()
val expectedRoot = mapper.readTree(File(combine("testfiles", "ns.json")))
HtmlReportGenerator(combine("testfiles", "ns.jtl"), combine("testfiles", "ns.properties"), testDirectory.toString()).run()
val actualRoot = mapper.readTree(File(testDirectory, "statistics.json"))
assertEquals(expectedRoot, actualRoot, "ns")
}
}

View File

@ -36,7 +36,7 @@
"sampleCount" : 252,
"errorCount" : 0,
"errorPct" : 0.0,
"meanResTime" : 235.90079365079367,
"meanResTime" : 235.9007936507938,
"medianResTime":232.0,
"minResTime" : 101.0,
"maxResTime" : 353.0,

View File

@ -80,25 +80,18 @@ public class ChangeCase extends AbstractFunction {
}
protected String changeCase(String originalString, String mode) {
String targetString = originalString;
// mode is case insensitive, allow upper for example
ChangeCaseMode changeCaseMode = ChangeCaseMode.typeOf(mode.toUpperCase(Locale.ROOT));
if (changeCaseMode != null) {
switch (changeCaseMode) {
case UPPER:
targetString = StringUtils.upperCase(originalString);
break;
case LOWER:
targetString = StringUtils.lowerCase(originalString);
break;
case CAPITALIZE:
targetString = StringUtils.capitalize(originalString);
break;
}
} else {
LOGGER.error("Unknown mode {}, returning {} unchanged", mode, targetString);
if (changeCaseMode == null) {
LOGGER.error("Unknown mode {}, returning {} unchanged", mode, originalString);
return originalString;
}
return targetString;
return switch (changeCaseMode) {
case UPPER -> StringUtils.upperCase(originalString);
case LOWER -> StringUtils.lowerCase(originalString);
case CAPITALIZE -> StringUtils.capitalize(originalString);
};
}
@Override

View File

@ -57,9 +57,9 @@ public class CharFunction extends AbstractFunction {
public String execute(SampleResult previousResult, Sampler currentSampler)
throws InvalidVariableException {
StringBuilder sb = new StringBuilder(values.length);
var sb = new StringBuilder(values.length);
for (Object val : values) {
String numberString = ((CompoundVariable) val).execute().trim();
var numberString = ((CompoundVariable) val).execute().trim();
try {
long value = Long.decode(numberString);
char ch = (char) value;

View File

@ -164,21 +164,11 @@ public class LogFunction extends AbstractFunction {
final String separator = comment.isEmpty() ? DEFAULT_SEPARATOR : comment;
switch (prioLevel) {
case ERROR:
logger.error("{} {} {}", threadName, separator, stringToLog, throwable);
break;
case WARN:
logger.warn("{} {} {}", threadName, separator, stringToLog, throwable);
break;
case INFO:
logger.info("{} {} {}", threadName, separator, stringToLog, throwable);
break;
case DEBUG:
logger.debug("{} {} {}", threadName, separator, stringToLog, throwable);
break;
case TRACE:
logger.trace("{} {} {}", threadName, separator, stringToLog, throwable);
break;
case ERROR -> logger.error("{} {} {}", threadName, separator, stringToLog, throwable);
case WARN -> logger.warn("{} {} {}", threadName, separator, stringToLog, throwable);
case INFO -> logger.info("{} {} {}", threadName, separator, stringToLog, throwable);
case DEBUG -> logger.debug("{} {} {}", threadName, separator, stringToLog, throwable);
case TRACE -> logger.trace("{} {} {}", threadName, separator, stringToLog, throwable);
}
}
}

View File

@ -182,8 +182,8 @@ public class RegexFunction extends AbstractFunction {
}
if (valueIndex.equals(ALL)) {
StringBuilder value = new StringBuilder();
Iterator<java.util.regex.MatchResult> it = collectAllMatches.iterator();
var value = new StringBuilder();
var it = collectAllMatches.iterator();
boolean first = true;
while (it.hasNext()) {
if (!first) {
@ -195,7 +195,7 @@ public class RegexFunction extends AbstractFunction {
}
return value.toString();
} else if (valueIndex.equals(RAND)) {
java.util.regex.MatchResult result = collectAllMatches.get(
var result = collectAllMatches.get(
ThreadLocalRandom.current().nextInt(collectAllMatches.size()));
return generateResult(result, name, tmplt, vars);
} else {
@ -313,7 +313,7 @@ public class RegexFunction extends AbstractFunction {
private static String generateResult(MatchResult match, String namep, Object[] template, JMeterVariables vars) {
saveGroups(match, namep, vars);
StringBuilder result = new StringBuilder();
var result = new StringBuilder();
for (Object t : template) {
if (t instanceof String) {
result.append(t);

View File

@ -296,7 +296,7 @@ public class StringFromFile extends AbstractFunction implements TestStateListene
checkParameterCount(parameters, MIN_PARAM_COUNT, MAX_PARAM_COUNT);
values = parameters.toArray();
StringBuilder sb = new StringBuilder(40);
var sb = new StringBuilder(40);
sb.append("setParameters(");//$NON-NLS-1$
for (int i = 0; i < values.length; i++) {
if (i > 0) {

View File

@ -95,8 +95,10 @@ public class HashTree implements Serializable, Map<Object, HashTree>, Cloneable
*/
private HashTree(Map<Object, ? extends HashTree> _map, Object key) {
if(_map != null) {
if (_map instanceof IdentityHashMap) {
data = (IdentityHashMap<Object, HashTree>) _map;
if (_map instanceof IdentityHashMap<?, ?> identityMapRaw) {
@SuppressWarnings("unchecked")
IdentityHashMap<Object, HashTree> identityMap = (IdentityHashMap<Object, HashTree>) identityMapRaw;
data = identityMap;
} else {
// Technically speaking, TestElements can't be placed in HashMapk keys,
// so we have to convert the map to an IdentityHashMap.
@ -122,8 +124,8 @@ public class HashTree implements Serializable, Map<Object, HashTree>, Cloneable
*/
@Override
public void putAll(Map<?, ? extends HashTree> map) {
if (map instanceof HashTree) {
this.add((HashTree) map);
if (map instanceof HashTree hashTree) {
this.add(hashTree);
} else {
throw new UnsupportedOperationException("can only putAll other HashTree objects");
}
@ -916,7 +918,7 @@ public class HashTree implements Serializable, Map<Object, HashTree>, Cloneable
if (o == this) {
return true;
}
if (!(o instanceof HashTree)) {
if (!(o instanceof HashTree hashTree)) {
return false;
}
HashTree oo = (HashTree) o;

View File

@ -17,6 +17,8 @@
package org.apache.jorphan.math;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ConcurrentModificationException;
import java.util.HashMap;
import java.util.Map;
@ -38,9 +40,9 @@ public abstract class StatCalculator<T extends Number & Comparable<? super T>> {
// We use a TreeMap because we need the entries to be sorted
// Running values, updated for each sample
private double sum = 0;
private BigDecimal sum = BigDecimal.ZERO;
private double sumOfSquares = 0;
private BigDecimal sumOfSquares = BigDecimal.ZERO;
private double mean = 0;
@ -79,8 +81,8 @@ public abstract class StatCalculator<T extends Number & Comparable<? super T>> {
public void clear() {
valuesMap.clear();
sum = 0;
sumOfSquares = 0;
sum = BigDecimal.ZERO;
sumOfSquares = BigDecimal.ZERO;
mean = 0;
deviation = 0;
count = 0;
@ -212,7 +214,7 @@ public abstract class StatCalculator<T extends Number & Comparable<? super T>> {
}
public double getSum() {
return sum;
return sum.doubleValue();
}
protected abstract T divide(T val, int n);
@ -227,10 +229,9 @@ public abstract class StatCalculator<T extends Number & Comparable<? super T>> {
*/
void addEachValue(T val, long sampleCount) {
count += sampleCount;
double currentVal = val.doubleValue();
sum += currentVal * sampleCount;
sum = sum.add(BigDecimal.valueOf(val.longValue()).multiply(BigDecimal.valueOf(sampleCount)));
// For n same values in sum of square is equal to n*val^2
sumOfSquares += currentVal * currentVal * sampleCount;
sumOfSquares = sumOfSquares.add(BigDecimal.valueOf(val.longValue()).multiply(BigDecimal.valueOf(val.longValue())).multiply(BigDecimal.valueOf(sampleCount)));
updateValueCount(val, sampleCount);
calculateDerivedValues(val);
}
@ -244,23 +245,23 @@ public abstract class StatCalculator<T extends Number & Comparable<? super T>> {
public void addValue(T val, long sampleCount) {
count += sampleCount;
double currentVal = val.doubleValue();
sum += currentVal;
sum = sum.add(BigDecimal.valueOf(val.longValue()));
T actualValue = val;
if (sampleCount > 1){
// For n values in an aggregate sample the average value = (val/n)
// So need to add n * (val/n) * (val/n) = val * val / n
sumOfSquares += currentVal * currentVal / sampleCount;
sumOfSquares = sumOfSquares.add(BigDecimal.valueOf(currentVal).multiply(BigDecimal.valueOf(currentVal)).divide(BigDecimal.valueOf(sampleCount), 16, RoundingMode.HALF_UP));
actualValue = divide(val, sampleCount);
} else { // no need to divide by 1
sumOfSquares += currentVal * currentVal;
sumOfSquares = sumOfSquares.add(BigDecimal.valueOf(currentVal).multiply(BigDecimal.valueOf(currentVal)));
}
updateValueCount(actualValue, sampleCount);
calculateDerivedValues(actualValue);
}
private void calculateDerivedValues(T actualValue) {
mean = sum / count;
deviation = Math.sqrt((sumOfSquares / count) - (mean * mean));
mean = sum.divide(BigDecimal.valueOf(count), 16, RoundingMode.HALF_UP).doubleValue();
deviation = Math.sqrt(sumOfSquares.divide(BigDecimal.valueOf(count), 16, RoundingMode.HALF_UP).subtract(sum.divide(BigDecimal.valueOf(count), 16, RoundingMode.HALF_UP).pow(2)).doubleValue());
if (actualValue.compareTo(max) > 0){
max=actualValue;
}

View File

@ -17,13 +17,15 @@
package org.apache.jorphan.math;
import java.math.BigInteger;
/**
* StatCalculator for Long values
*/
public class StatCalculatorLong extends StatCalculator<Long> {
public class StatCalculatorLong extends StatCalculator<BigInteger> {
public StatCalculatorLong() {
super(0L, Long.MIN_VALUE, Long.MAX_VALUE);
super(BigInteger.ZERO, BigInteger.valueOf(Long.MIN_VALUE), BigInteger.valueOf(Long.MAX_VALUE));
}
/**
@ -32,7 +34,7 @@ public class StatCalculatorLong extends StatCalculator<Long> {
* @param val the value to add, which should correspond with a single sample
*/
public void addValue(long val){
super.addValue(val);
super.addValue(BigInteger.valueOf(val));
}
/**
@ -42,16 +44,16 @@ public class StatCalculatorLong extends StatCalculator<Long> {
* @param sampleCount the number of samples contributing to the aggregate value
*/
public void addValue(long val, int sampleCount){
super.addValue(val, sampleCount);
super.addValue(BigInteger.valueOf(val), sampleCount);
}
@Override
protected Long divide(Long val, int n) {
return val / n;
protected BigInteger divide(BigInteger val, int n) {
return val.divide(BigInteger.valueOf(n));
}
@Override
protected Long divide(Long val, long n) {
return val / n;
protected BigInteger divide(BigInteger val, long n) {
return val.divide(BigInteger.valueOf(n));
}
}

View File

@ -90,8 +90,8 @@ public class Converter {
*/
public static Calendar getCalendar(Object date, Calendar defaultValue) {
Calendar cal = new GregorianCalendar();
if (date instanceof java.util.Date) {
cal.setTime((java.util.Date) date);
if (date instanceof java.util.Date dateValue) {
cal.setTime(dateValue);
return cal;
} else if (date != null) {
Optional<Date> d = tryToParseDate(date);
@ -145,8 +145,8 @@ public class Converter {
* <code>defaultValue</code> if conversion failed
*/
public static Date getDate(Object date, Date defaultValue) {
if (date instanceof java.util.Date) {
return (Date) date;
if (date instanceof java.util.Date dateValue) {
return dateValue;
} else if (date != null) {
return tryToParseDate(date).orElse(defaultValue);
} else {
@ -182,8 +182,8 @@ public class Converter {
if (o == null) {
return defaultValue;
}
if (o instanceof Number) {
return ((Number) o).floatValue();
if (o instanceof Number number) {
return number.floatValue();
}
try {
return Float.parseFloat(o.toString());
@ -221,8 +221,8 @@ public class Converter {
if (o == null) {
return defaultValue;
}
if (o instanceof Number) {
return ((Number) o).doubleValue();
if (o instanceof Number number) {
return number.doubleValue();
}
return Double.parseDouble(o.toString());
} catch (NumberFormatException e) {
@ -270,8 +270,8 @@ public class Converter {
public static boolean getBoolean(Object o, boolean defaultValue) {
if (o == null) {
return defaultValue;
} else if (o instanceof Boolean) {
return (Boolean) o;
} else if (o instanceof Boolean boolValue) {
return boolValue;
}
return Boolean.parseBoolean(o.toString());
}
@ -291,8 +291,8 @@ public class Converter {
if (o == null) {
return defaultValue;
}
if (o instanceof Number) {
return ((Number) o).intValue();
if (o instanceof Number number) {
return number.intValue();
}
return Integer.parseInt(o.toString());
} catch (NumberFormatException e) {
@ -327,12 +327,12 @@ public class Converter {
if (o == null) {
return defaultValue;
}
if (o instanceof Character) {
return (Character) o;
} else if (o instanceof Byte) {
return (char) ((Byte) o).byteValue();
} else if (o instanceof Integer) {
return (char) ((Integer) o).intValue();
if (o instanceof Character charValue) {
return charValue;
} else if (o instanceof Byte byteValue) {
return (char) byteValue.byteValue();
} else if (o instanceof Integer intValue) {
return (char) intValue.intValue();
} else {
String s = o.toString();
if (s.length() > 0) {
@ -373,8 +373,8 @@ public class Converter {
if (o == null) {
return defaultValue;
}
if (o instanceof Number) {
return ((Number) o).longValue();
if (o instanceof Number number) {
return number.longValue();
}
return Long.parseLong(o.toString());
} catch (NumberFormatException e) {
@ -546,11 +546,11 @@ public class Converter {
* when object can not be converted
*/
public static File getFile(Object o){
if (o instanceof File) {
return (File) o;
if (o instanceof File file) {
return file;
}
if (o instanceof String) {
return new File((String) o);
if (o instanceof String str) {
return new File(str);
}
throw new IllegalArgumentException("Expected String or file, actual "+o.getClass().getName());
}

View File

@ -20,6 +20,7 @@ package org.apache.jorphan.math;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.math.BigInteger;
import java.util.Map;
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
@ -107,8 +108,8 @@ public class TestStatCalculator {
calc.addValue(0L);
calc.addValue(2L);
calc.addValue(2L);
final Long long0 = 0L;
final Long long2 = 2L;
final BigInteger long0 = BigInteger.valueOf(0L);
final BigInteger long2 = BigInteger.valueOf(2L);
assertEquals(long2, calc.getMax());
assertEquals(long0, calc.getMin());
Map<Number, Number[]> map = calc.getDistribution();
@ -141,7 +142,7 @@ public class TestStatCalculator {
calc.addValue(2L);
assertEquals(6, calc.getCount());
assertEquals(12.0, calc.getSum(), 0.000000000001);
assertEquals(0.5773502691896255, calc.getStandardDeviation(), 0.000000000000001);
assertEquals(0.5773502691896257, calc.getStandardDeviation(), 0.000000000000001);
}
@Test
@ -150,10 +151,10 @@ public class TestStatCalculator {
calc.addValue(1L);
calc.addValue(2L);
calc.addValue(3L);
calc.addEachValue(2L, 3);
calc.addEachValue(BigInteger.valueOf(2L), 3);
assertEquals(6, calc.getCount());
assertEquals(12.0, calc.getSum(), 0.000000000001);
assertEquals(0.5773502691896255, calc.getStandardDeviation(), 0.000000000000001);
assertEquals(0.5773502691896257, calc.getStandardDeviation(), 0.000000000000001);
}
@Test
@ -164,7 +165,7 @@ public class TestStatCalculator {
calc.addValue(6L, 3);
assertEquals(6, calc.getCount());
assertEquals(12.0, calc.getSum(), 0.00000001);
assertEquals(0.5773502691896255, calc.getStandardDeviation(), 0.000000000000001);
assertEquals(0.5773502691896257, calc.getStandardDeviation(), 0.000000000000001);
}
@Test
@ -179,6 +180,6 @@ public class TestStatCalculator {
calc.addAll(calc2);
assertEquals(6, calc.getCount());
assertEquals(12.0, calc.getSum(), 0.000000000001);
assertEquals(0.5773502691896255, calc.getStandardDeviation(), 0.000000000000001);
assertEquals(0.5773502691896257, calc.getStandardDeviation(), 0.000000000000001);
}
}

View File

@ -211,8 +211,8 @@ public class CacheManager extends ConfigTestElement implements TestStateListener
if (headerName == null) {
return null;
}
final Set<String> names = new HashSet<>(Arrays.asList(headerName.split(",\\s*")));
final Map<String, List<String>> values = new HashMap<>();
final var names = new HashSet<>(Arrays.asList(headerName.split(",\\s*")));
final var values = new HashMap<String, List<String>>();
for (final String name: names) {
values.put(name, new ArrayList<>());
}

View File

@ -287,19 +287,12 @@ public class BasicCurlParser {
public void setLimitRate(String limitRate) {
String unit = limitRate.substring(limitRate.length() - 1, limitRate.length()).toLowerCase(Locale.ROOT);
int value = Integer.parseInt(limitRate.substring(0, limitRate.length() - 1).toLowerCase(Locale.ROOT));
switch (unit) {
case "k":
this.limitRate = value * ONE_KILOBYTE_IN_CPS;
break;
case "m":
this.limitRate = value * ONE_KILOBYTE_IN_CPS * 1000;
break;
case "g":
this.limitRate = value * ONE_KILOBYTE_IN_CPS * 1000000;
break;
default:
break;
}
this.limitRate = switch (unit) {
case "k" -> value * ONE_KILOBYTE_IN_CPS;
case "m" -> value * ONE_KILOBYTE_IN_CPS * 1000;
case "g" -> value * ONE_KILOBYTE_IN_CPS * 1000000;
default -> this.limitRate; // Keep current value if unit is not recognized
};
}
/**
@ -640,8 +633,9 @@ public class BasicCurlParser {
"Tells curl to use HTTP negotiate authentication when communicating with the given proxy. ");
private static final CLOptionDescriptor D_KEEPALIVETILE_OPT = new CLOptionDescriptor("keepalive-time",
CLOptionDescriptor.ARGUMENT_REQUIRED, KEEPALIVETILE_OPT,
" This option sets the time a connection needs to remain idle before sending"
+ " keepalive probes and the time between individual keepalive probes..");
"""
This option sets the time a connection needs to remain idle before sending \
keepalive probes and the time between individual keepalive probes..""");
private static final CLOptionDescriptor D_MAX_TIME_OPT = new CLOptionDescriptor("max-time",
CLOptionDescriptor.ARGUMENT_REQUIRED, MAX_TIME_OPT,
"Maximum time in seconds that you allow the whole operation to take. ");
@ -652,8 +646,9 @@ public class BasicCurlParser {
"Create the necessary local directory hierarchy as needed for output file");
private static final CLOptionDescriptor D_RAW_OPT = new CLOptionDescriptor("raw",
CLOptionDescriptor.ARGUMENT_DISALLOWED, RAW_OPT,
"When used, it disables all internal HTTP decoding of content or transfer encodings "
+ "and instead makes them passed on unaltered raw. ");
"""
When used, it disables all internal HTTP decoding of content or transfer \
encodings and instead makes them passed on unaltered raw.""");
private static final CLOptionDescriptor D_INTERFACE_OPT = new CLOptionDescriptor("interface",
CLOptionDescriptor.ARGUMENT_REQUIRED, INTERFACE_OPT, "Perform an operation using a specified interface");
private static final CLOptionDescriptor D_DNS_RESOLVER_OPT = new CLOptionDescriptor("resolve",

View File

@ -119,20 +119,12 @@ public class ConversionUtils {
StringBuilder sb = new StringBuilder(value.length() + 2);
for (int i = 0; i < value.length(); i++) {
char c = value.charAt(i);
switch (c) {
case '"':
sb.append("%22");
break;
case 0x0A:
sb.append("%0A");
break;
case 0x0D:
sb.append("%0D");
break;
default:
sb.append(c);
break;
}
sb.append(switch (c) {
case '"' -> "%22";
case 0x0A -> "%0A";
case 0x0D -> "%0D";
default -> String.valueOf(c);
});
}
return sb.toString();
}

View File

@ -286,10 +286,10 @@ public class RequestViewHTTP implements RequestView {
//TODO: move to utils class (JMeterUtils?)
public static Map<String, String[]> getQueryMap(String query) {
Map<String, String[]> map = new HashMap<>();
String[] params = query.split(PARAM_CONCATENATE);
var map = new HashMap<String, String[]>();
var params = query.split(PARAM_CONCATENATE);
for (String param : params) {
String[] paramSplit = param.split("=");
var paramSplit = param.split("=");
if (paramSplit.length == 0) {
continue; // We found no key-/value-pair, so continue on the next param
}

View File

@ -76,12 +76,13 @@ public class TestHttpRequestHdr extends JMeterTestCase {
// A HTTP POST request
contentEncoding = "UTF-8";
String postBody = "update=yes&d=1&d=2&d=&d=&d=&d=&d=&d=1&d=2&d=1&d=&d=";
String testPostRequest = "POST " + url + " HTTP/1.0\n"
+ "Content-type: "
+ HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n"
+ "Content-length: " + getBodyLength(postBody, contentEncoding) + "\r\n"
+ "\r\n"
+ postBody;
String testPostRequest = """
POST %s HTTP/1.0
Content-type: %s\r
Content-length: %d\r
\r
%s""".formatted(url, HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED,
getBodyLength(postBody, contentEncoding), postBody);
s = getSamplerForRequest(url, testPostRequest, contentEncoding);
assertEquals(HTTPConstants.POST, s.getMethod());
assertFalse(s.getDoMultipart());
@ -147,35 +148,37 @@ public class TestHttpRequestHdr extends JMeterTestCase {
// The encoding should be picked up from the header we send with the request
contentEncoding = "UTF-8";
url = "http://vmdal-hqqa9/retalixhq/GG_Implementation/ScreenEntity/ScreenEntityHTTP.aspx?Action=Save&ET=Vendor&TT=Single&Sid=1347280336092";
postBody = "<Action UIStatus=\"2\"><Vendor Id=\"9292\" HOST_ID=\"0\" VENDOR=\"9292\" TERMS_TYPE=\"No Terms\" TERMS=\"0 %\""
+ " AUTO_PRICE=\"Use System Default\" VM_VENDOR_TYPE=\"DSD Vendor\" ITEM_FORMAT=\"PLU\" COST_ENTRY_SORT=\"UPC/EAN\""
+ " VM_REPORT_SORT=\"UPC/EAN\" VM_ORDER_SORT=\"UPC/EAN\" VM_RECEIVING_SORT=\"UPC/EAN\" VM_MAX_BACK_ORDERS=\"99\""
+ " MAX_OPEN_DAYS=\"99\" PAY_BASED_ON=\"System Cost\" ORDER_COST_DATE=\"Use System Rule\" VM_CONSIDER_FREE=\"False\""
+ " VM_SHOW_DETAIL=\"False\" VM_UPDATE_COST=\"No\" RD_USE_VENDOR_CC=\"False\" BLIND_RECEIVING=\"Default\""
+ " EXCLUDE_RECEIVED_COST=\"False\" PRINT_ITEM_ADJ=\"False\" PRINT_OVERALL_ADJ=\"False\" PRINT_TAX_DETAIL=\"False\""
+ " BLOCK_PRICE_VIEW=\"False\" DELIVERY_STATUS=\"No Delivery\" AUTO_RECEIVE=\"False\" TARGET_GM_FLAG=\"%\""
+ " MINIMUM_GM_FLAG=\"%\" MARGIN_TYPE=\"Gross Margin\" HOLD_REGULAR=\"Default\" HOLD_SPECIALS=\"Default\""
+ " TRUSTING_VENDOR=\"False\" AUTO_ACCEPT=\"All\" EARLY_RCPT_AFFECTS=\"All Costs\" SBT_ELIGIBLE=\"Not eligible\""
+ " SBT_REPORTING_DAY=\"Monday\" AUTO_BALANCE_FLAG=\"$\" DAX_MANAGED=\"False\" CHANGE_ID=\"QA\" CHANGE_SOURCE=\"Manual Change\""
+ " ORIGINAL_SOURCE=\"Manual Change\" RECORD_STATUS=\"Add\" RECORD_STATUS_DATE=\"9/7/2012 8:34:58 AM\" VENDOR_NAME=\"test\""
+ " UIStatus=\"2\"/></Action>";
testPostRequest = "POST " + url + " HTTP/1.1\r\n"
+ "x-requested-with: XMLHttpRequest" + "\r\n"
+ "Accept-Language: en-us" + "\r\n"
+ "Referer: http://vmdal-hqqa9/retalixhq/GG_Implementation/ScreenEntity/ScreenEntityPage.aspx?ET=Vendor&TT=Single&"
+ "WM=2&UID=9292&Sid=1347280331908&UITH=Blue&MUID=window_0" + "\r\n"
+ "Accept: */*" + "\r\n"
+ "Content-Type: application/x-www-form-urlencoded" + "\r\n"
+ "Accept-Encoding: gzip, deflate" + "\r\n"
+ "User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729;"
+ " .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; Tablet PC 2.0)" + "\r\n"
+ "Host: vmdal-hqqa9" + "\r\n"
+ "Content-Length: "+ getBodyLength(postBody, contentEncoding) + "\r\n"
+ "Proxy-Connection: Keep-Alive" + "\r\n"
+ "Pragma: no-cache" + "\r\n"
+ "Cookie: RHQ=sid=5aaeb66c-e174-4f4c-9928-83cffcc62150" + "\r\n"
+ "\r\n"
+ postBody;
postBody = """
<Action UIStatus="2">
<Vendor Id="9292" HOST_ID="0" VENDOR="9292" TERMS_TYPE="No Terms" TERMS="0 %"\
AUTO_PRICE="Use System Default" VM_VENDOR_TYPE="DSD Vendor" ITEM_FORMAT="PLU" COST_ENTRY_SORT="UPC/EAN"\
VM_REPORT_SORT="UPC/EAN" VM_ORDER_SORT="UPC/EAN" VM_RECEIVING_SORT="UPC/EAN" VM_MAX_BACK_ORDERS="99"\
MAX_OPEN_DAYS="99" PAY_BASED_ON="System Cost" ORDER_COST_DATE="Use System Rule" VM_CONSIDER_FREE="False"\
VM_SHOW_DETAIL="False" VM_UPDATE_COST="No" RD_USE_VENDOR_CC="False" BLIND_RECEIVING="Default"\
EXCLUDE_RECEIVED_COST="False" PRINT_ITEM_ADJ="False" PRINT_OVERALL_ADJ="False" PRINT_TAX_DETAIL="False"\
BLOCK_PRICE_VIEW="False" DELIVERY_STATUS="No Delivery" AUTO_RECEIVE="False" TARGET_GM_FLAG="%"\
MINIMUM_GM_FLAG="%" MARGIN_TYPE="Gross Margin" HOLD_REGULAR="Default" HOLD_SPECIALS="Default"\
TRUSTING_VENDOR="False" AUTO_ACCEPT="All" EARLY_RCPT_AFFECTS="All Costs" SBT_ELIGIBLE="Not eligible"\
SBT_REPORTING_DAY="Monday" AUTO_BALANCE_FLAG="$" DAX_MANAGED="False" CHANGE_ID="QA" CHANGE_SOURCE="Manual Change"\
ORIGINAL_SOURCE="Manual Change" RECORD_STATUS="Add" RECORD_STATUS_DATE="9/7/2012 8:34:58 AM" VENDOR_NAME="test"\
UIStatus="2"/>
</Action>""";
testPostRequest = """
POST %s HTTP/1.1\r
x-requested-with: XMLHttpRequest\r
Accept-Language: en-us\r
Referer: http://vmdal-hqqa9/retalixhq/GG_Implementation/ScreenEntity/ScreenEntityPage.aspx?ET=Vendor&TT=Single&WM=2&UID=9292&Sid=1347280331908&UITH=Blue&MUID=window_0\r
Accept: */*\r
Content-Type: application/x-www-form-urlencoded\r
Accept-Encoding: gzip, deflate\r
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; Tablet PC 2.0)\r
Host: vmdal-hqqa9\r
Content-Length: %d\r
Proxy-Connection: Keep-Alive\r
Pragma: no-cache\r
Cookie: RHQ=sid=5aaeb66c-e174-4f4c-9928-83cffcc62150\r
\r
%s""".formatted(url, getBodyLength(postBody, contentEncoding), postBody);
// Use null for url to simulate that HttpRequestHdr do not
// know the encoding for the page. Specify contentEncoding, so the
// request is "sent" using that encoding
@ -594,27 +597,34 @@ public class TestHttpRequestHdr extends JMeterTestCase {
private String createMultipartFormBody(String titleValue, String descriptionValue,
String contentEncoding, boolean includeExtraHeaders,
String boundary, String endOfLine) {
// Title multipart
String postBody = "--" + boundary + endOfLine
+ "Content-Disposition: form-data; name=\"title\"" + endOfLine;
if(includeExtraHeaders) {
postBody += "Content-Type: text/plain; charset=" + contentEncoding + endOfLine
+ "Content-Transfer-Encoding: 8bit" + endOfLine;
}
postBody += endOfLine
+ titleValue + endOfLine
+ "--" + boundary + endOfLine;
// Description multipart
postBody += "Content-Disposition: form-data; name=\"description\"" + endOfLine;
if(includeExtraHeaders) {
postBody += "Content-Type: text/plain; charset=" + contentEncoding + endOfLine
+ "Content-Transfer-Encoding: 8bit" + endOfLine;
}
postBody += endOfLine
+ descriptionValue + endOfLine
+ "--" + boundary + "--" + endOfLine;
return postBody;
String titleHeaders = includeExtraHeaders ? """
Content-Type: text/plain; charset=%s%s\
Content-Transfer-Encoding: 8bit%s""".formatted(contentEncoding, endOfLine, endOfLine) : "";
String descriptionHeaders = includeExtraHeaders ? """
Content-Type: text/plain; charset=%s%s\
Content-Transfer-Encoding: 8bit%s""".formatted(contentEncoding, endOfLine, endOfLine) : "";
return """
--%s%s\
Content-Disposition: form-data; name="title"%s\
%s%s\
%s%s\
--%s%s\
Content-Disposition: form-data; name="description"%s\
%s%s\
%s%s\
--%s--%s""".formatted(
boundary, endOfLine,
endOfLine,
titleHeaders, endOfLine,
titleValue, endOfLine,
boundary, endOfLine,
endOfLine,
descriptionHeaders, endOfLine,
descriptionValue, endOfLine,
boundary, endOfLine);
}
private String createMultipartFileUploadBody(String fileField, String fileName,

View File

@ -45,23 +45,25 @@ class TestGraphQLRequestParamUtils {
private static final String OPERATION_NAME = "";
private static final String QUERY =
"query($id: ID!) {\n"
+ " droid(id: $id) {\n"
+ " id\n"
+ " name\n"
+ " friends {\n"
+ " id\n"
+ " name\n"
+ " appearsIn\n"
+ " }\n"
+ " }\n"
+ "}\n";
private static final String QUERY = """
query($id: ID!) {
droid(id: $id) {
id
name
friends {
id
name
appearsIn
}
}
}
""";
private static final String VARIABLES =
"{\n"
+ " \"id\": \"2001\"\n"
+ "}\n";
private static final String VARIABLES = """
{
"id": "2001"
}
""";
private static final String EXPECTED_QUERY_GET_PARAM_VALUE =
"query($id: ID!) { droid(id: $id) { id name friends { id name appearsIn } } }";

View File

@ -31,7 +31,7 @@ class JSR223SamplerTest {
sampler.setScript("SampleResult.setEndTime(42); 'OK'");
sampler.setScriptLanguage("groovy");
SampleResult sampleResult = sampler.sample(null);
assertEquals(42, sampleResult.getEndTime());
assertEquals(42000000, sampleResult.getEndTime());
}
@Test
@ -41,6 +41,6 @@ class JSR223SamplerTest {
sampler.setScript("'OK'");
sampler.setScriptLanguage("groovy");
SampleResult sampleResult = sampler.sample(null);
assertEquals(System.currentTimeMillis(), sampleResult.getEndTime(), 1000);
assertEquals(System.currentTimeMillis() * 1000000L, sampleResult.getEndTime(), 1000 * 1000000L);
}
}

View File

@ -164,8 +164,7 @@ public class DataSourceElement extends AbstractTestElement
public static String getConnectionInfo(String poolName) throws SQLException{
Object poolObject =
JMeterContextService.getContext().getVariables().getObject(poolName);
if (poolObject instanceof DataSourceComponentImpl) {
DataSourceComponentImpl pool = (DataSourceComponentImpl) poolObject;
if (poolObject instanceof DataSourceComponentImpl pool) {
return pool.getConnectionInfo();
} else {
return "Object:" + poolName + " is not of expected type '" + DataSourceComponentImpl.class.getName() + "'";
@ -194,8 +193,7 @@ public class DataSourceElement extends AbstractTestElement
if (poolObject == null) {
throw new SQLException("No pool found named: '" + poolName + "', ensure Variable Name matches Variable Name of JDBC Connection Configuration");
} else {
if(poolObject instanceof DataSourceComponentImpl) {
DataSourceComponentImpl pool = (DataSourceComponentImpl) poolObject;
if(poolObject instanceof DataSourceComponentImpl pool) {
return pool.getConnection();
} else {
String errorMsg = "Found object stored under variable:'" + poolName + "' with class:"

View File

@ -307,8 +307,8 @@ public class JMSSampler extends AbstractSampler implements ThreadListener {
if (replyMsg == null) {
res.setResponseMessage("No reply message received");
} else {
if (replyMsg instanceof TextMessage) {
res.setResponseData(((TextMessage) replyMsg).getText(), null);
if (replyMsg instanceof TextMessage textMessage) {
res.setResponseData(textMessage.getText(), null);
} else {
res.setResponseData(replyMsg.toString(), null);
}
@ -355,20 +355,17 @@ public class JMSSampler extends AbstractSampler implements ThreadListener {
private static void extractContent(StringBuilder buffer, StringBuilder propBuffer, Message msg) {
if (msg != null) {
try {
if (msg instanceof TextMessage) {
buffer.append(((TextMessage) msg).getText());
} else if (msg instanceof ObjectMessage) {
ObjectMessage objectMessage = (ObjectMessage) msg;
if (msg instanceof TextMessage textMessage) {
buffer.append(textMessage.getText());
} else if (msg instanceof ObjectMessage objectMessage) {
if (objectMessage.getObject() != null) {
buffer.append(objectMessage.getObject().getClass());
} else {
buffer.append("object is null");
}
} else if (msg instanceof BytesMessage) {
BytesMessage bytesMessage = (BytesMessage) msg;
} else if (msg instanceof BytesMessage bytesMessage) {
buffer.append(bytesMessage.getBodyLength() + " bytes received in BytesMessage");
} else if (msg instanceof MapMessage) {
MapMessage mapm = (MapMessage) msg;
} else if (msg instanceof MapMessage mapm) {
@SuppressWarnings("unchecked") // MapNames are Strings
Enumeration<String> enumb = mapm.getMapNames();
while (enumb.hasMoreElements()) {
@ -484,8 +481,8 @@ public class JMSSampler extends AbstractSampler implements ThreadListener {
Object o = getProperty(JMS_PROPERTIES).getObjectValue();
JMSProperties jmsProperties = null;
// Backward compatibility with versions <= 2.10
if (o instanceof Arguments) {
jmsProperties = Utils.convertArgumentsToJmsProperties((Arguments) o);
if (o instanceof Arguments arguments) {
jmsProperties = Utils.convertArgumentsToJmsProperties(arguments);
} else {
jmsProperties = (JMSProperties) o;
}