Class Sample
-
- All Implemented Interfaces:
public class 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
Constructors Constructor Description Sample(long row, SampleMetadata metadata, Array<String> data)
Build a sample from a string array
-
Method Summary
Modifier and Type Method Description long
getSampleRow()
String
getData(int index)
Gets the data stored in the column with the specified rank. String
getData(String name)
Gets the data stored in the column with the specified name. <T> T
getData(Class<T> clazz, int index, String fieldName)
Gets the data of the column matching the specified rank and converts it to an alternative type. <T> T
getData(Class<T> clazz, String name)
Gets the data of the column matching the specified name and converts it to an alternative type. String
toString()
long
getTimestamp()
Gets the time stamp stored in the sample. long
getElapsedTime()
Gets the elapsed time stored in the sample. long
getStartTime()
Gets the start time of the sample. long
getEndTime()
Gets the end time of the sample. String
getResponseCode()
Gets the response code stored in the sample. String
getFailureMessage()
Gets the failure message stored in the sample. String
getName()
Gets the name stored in the sample. String
getResponseMessage()
Gets the response message stored in the sample. long
getLatency()
Gets the latency stored in the sample. long
getConnectTime()
Gets the connect time stored in the sample. boolean
getSuccess()
Gets the success status stored in the sample. long
getReceivedBytes()
Gets the number of received bytes stored in the sample. long
getSentBytes()
Gets the number of sent bytes stored in the sample. int
getGroupThreads()
Gets the number of threads in the group of this sample. int
getAllThreads()
Gets the overall number of threads. String
getThreadName()
Gets the thread name stored in the sample. boolean
isController()
Checks if this sample is a controller. boolean
isEmptyController()
Checks if this sample is an empty controller. -
-
Constructor Detail
-
Sample
Sample(long row, SampleMetadata metadata, Array<String> data)
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 Detail
-
getSampleRow
long getSampleRow()
- Returns:
the row number from the CSV source from which this sample has been built.
-
getData
String getData(int index)
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
String getData(String name)
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
<T> T getData(Class<T> clazz, int index, String fieldName)
Gets the data of the column matching the specified rank and converts it to an alternative type.
- Parameters:
clazz
- the target class of the dataindex
- the rank of the columnfieldName
- Field name- Returns:
the converted value of the data
-
getData
<T> T getData(Class<T> clazz, String name)
Gets the data of the column matching the specified name and converts it to an alternative type.
- Parameters:
clazz
- the target class of the dataname
- the name of the column- Returns:
the converted value of the data
-
getTimestamp
long getTimestamp()
Gets the time stamp stored in the sample.
- Returns:
the time stamp
-
getElapsedTime
long getElapsedTime()
Gets the elapsed time stored in the sample.
- Returns:
the elapsed time stored in the sample
-
getStartTime
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
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
String getResponseCode()
Gets the response code stored in the sample.
- Returns:
the response code stored in the sample
-
getFailureMessage
String getFailureMessage()
Gets the failure message stored in the sample.
- Returns:
the failure message stored in the sample
-
getResponseMessage
String getResponseMessage()
Gets the response message stored in the sample.
- Returns:
the response message stored in the sample
-
getLatency
long getLatency()
Gets the latency stored in the sample.
- Returns:
the latency stored in the sample
-
getConnectTime
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
boolean getSuccess()
Gets the success status stored in the sample.
- Returns:
the success status stored in the sample
-
getReceivedBytes
long getReceivedBytes()
Gets the number of received bytes stored in the sample.
- Returns:
the number of received bytes stored in the sample
-
getSentBytes
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
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
int getAllThreads()
Gets the overall number of threads.
- Returns:
the overall number of threads
-
getThreadName
String getThreadName()
Gets the thread name stored in the sample.
- Returns:
the thread name stored in the sample
-
isController
boolean isController()
Checks if this sample is a controller.
- Returns:
true
, if this sample is a controller; otherwisefalse
-
isEmptyController
boolean isEmptyController()
Checks if this sample is an empty controller.
- Returns:
true
, if this sample is a controller; otherwisefalse
-
-
-
-