Package org.apache.jmeter.report.core
Class Sample
java.lang.Object
org.apache.jmeter.report.core.Sample
Represents a sample read from a CSV source.
Getters with a string parameter are implemented for convenience but should be avoided as they are inefficient
- Since:
- 3.0
-
Constructor Summary
ConstructorDescriptionSample
(long row, SampleMetadata metadata, String... data) Build a sample from a string array -
Method Summary
Modifier and TypeMethodDescriptionint
Gets the overall number of threads.long
Gets the connect time stored in the sample.getData
(int index) Gets the data stored in the column with the specified rank.<T> T
Gets the data of the column matching the specified rank and converts it to an alternative type.<T> T
Gets the data of the column matching the specified name and converts it to an alternative type.Gets the data stored in the column with the specified name.long
Gets the elapsed time stored in the sample.long
Gets the end time of the sample.Gets the failure message stored in the sample.int
Gets the number of threads in the group of this sample.long
Gets the latency stored in the sample.getName()
Gets the name stored in the sample.long
Gets the number of received bytes stored in the sample.Gets the response code stored in the sample.Gets the response message stored in the sample.long
long
Gets the number of sent bytes stored in the sample.long
Gets the start time of the sample.boolean
Gets the success status stored in the sample.Gets the thread name stored in the sample.long
Gets the time stamp stored in the sample.boolean
Checks if this sample is a controller.boolean
Checks if this sample is an empty controller.toString()
-
Constructor Details
-
Sample
Build a sample from a string array- Parameters:
row
- the row number in the CSV source from which this sample is builtmetadata
- The sample metadata (contains column names)data
- The sample data as a string array
-
-
Method Details
-
getSampleRow
public long getSampleRow()- Returns:
- the row number from the CSV source from which this sample has been built.
-
getData
Gets the data stored in the column with the specified rank.- Parameters:
index
- the rank of the column- Returns:
- the data of the column
-
getData
Gets the data stored in the column with the specified name.- Parameters:
name
- the name of the column- Returns:
- the data of the column
-
getData
Gets the data of the column matching the specified rank and converts it to an alternative type.- Type Parameters:
T
- type of data to be fetched- Parameters:
clazz
- the target class of the dataindex
- the rank of the columnfieldName
- Field name- Returns:
- the converted value of the data
-
getData
Gets the data of the column matching the specified name and converts it to an alternative type.- Type Parameters:
T
- type of data to be fetched- Parameters:
clazz
- the target class of the dataname
- the name of the column- Returns:
- the converted value of the data
-
toString
-
getTimestamp
public long getTimestamp()Gets the time stamp stored in the sample.- Returns:
- the time stamp
-
getElapsedTime
public long getElapsedTime()Gets the elapsed time stored in the sample.- Returns:
- the elapsed time stored in the sample
-
getStartTime
public long getStartTime()Gets the start time of the sample.
Start time depends on sampleresult.timestamp.start property :
- If the property is true, this method returns the time stamp stored in the sample.
- If the property is false, this method returns the time stamp stored in the sample minus the elapsed time.
- Returns:
- the start time
-
getEndTime
public long getEndTime()Gets the end time of the sample.
End time depends on jmeter.timestamp.start property :
- If the property is true, this method returns the time stamp recorded in the sample plus the elapsed time.
- If the property is false, this method returns the time stamp recorded.
- Returns:
- the end time
-
getResponseCode
Gets the response code stored in the sample.- Returns:
- the response code stored in the sample
-
getFailureMessage
Gets the failure message stored in the sample.- Returns:
- the failure message stored in the sample
-
getName
Gets the name stored in the sample.- Returns:
- the name stored in the sample
-
getResponseMessage
Gets the response message stored in the sample.- Returns:
- the response message stored in the sample
-
getLatency
public long getLatency()Gets the latency stored in the sample.- Returns:
- the latency stored in the sample
-
getConnectTime
public long getConnectTime()Gets the connect time stored in the sample.- Returns:
- the connect time stored in the sample or 0 is column is not in results
-
getSuccess
public boolean getSuccess()Gets the success status stored in the sample.- Returns:
- the success status stored in the sample
-
getReceivedBytes
public long getReceivedBytes()Gets the number of received bytes stored in the sample.- Returns:
- the number of received bytes stored in the sample
-
getSentBytes
public long getSentBytes()Gets the number of sent bytes stored in the sample. If column is not in results, we return 0- Returns:
- the number of sent bytes stored in the sample
-
getGroupThreads
public int getGroupThreads()Gets the number of threads in the group of this sample.- Returns:
- the number of threads in the group of this sample
-
getAllThreads
public int getAllThreads()Gets the overall number of threads.- Returns:
- the overall number of threads
-
getThreadName
Gets the thread name stored in the sample.- Returns:
- the thread name stored in the sample
-
isController
public boolean isController()Checks if this sample is a controller.- Returns:
true
, if this sample is a controller; otherwisefalse
-
isEmptyController
public boolean isEmptyController()Checks if this sample is an empty controller.- Returns:
true
, if this sample is a controller; otherwisefalse
-