lr.user_data_point
Records a user-defined data sample.
JavaScript
function lr.user_data_point(sample_name,value)
VBScript
Function lr.user_data_point(sample_name,value)
| Informational Functions |
Arguments
| Name | Comments |
|---|---|
| sample_name | The data point name. |
| value | The value to record. |
The lr.user_data_point function allows you to record your own data for analysis. Each time you want to record a point, use this function to record the sample name and the value. The time of the sample is recorded automatically. After the execution, you can use the User Defined Data Points graph to analyze the results.
The following prefixes in sample_name are reserved:
- HTTP
- NON_HTTP
- RETRY
- mic_
- stream_
- mms_
A data point with any of these prefixes, for example "HTTP_BT", will not appear on the graph. However, the prefixes are case-sensitive, therefore "http_BT" is a valid sample_name.
Return Values
Returns 0 on success and -1 on failure.
Parameterization
All string input arguments can be passed using standard parameterization.VBScript Example
In the following example, the state of the server is checked five times in the middle of a test and data points are recorded with the results for later analysis. The example assumes that site being tested has an API named getSessionsCount that returns the desired test data.
Note that the use of such an API, if the call is only for testing purposes and not part of the business process, may create an unreasonably long transaction if the normal start_transaction - end_transaction mechanism is used. In this example, the transaction is created with set_transaction using only the duration of the business process, without the duration of the API calls.
Dim i as Integer Dim before_api as Double Dim api_time as Double Dim start_transaction as Double Dim transaction_time as Double ' Mark the start of the transaction start_transaction = Timer ' .... Business process 'In the middle of the process, use an API to ` get information about the current state of the server. ` First record the start time of the check before_api = Timer ' The server state is dynamic, so take five samples at one second intervals For i = 1 to 5 ' Get the state with a call to your application's ` API, getSessionsCount, and ` create a data point for each sample lr.user_data_point "Sessions" , getSessionsCount() lr.think_time 1 Next i ' Get the total time spent on the check api_time = Timer - before_api ' .... Continue business process ' The time spent on the business process is the ' elapsed time minus the time spent getting the ' server state samples. transaction_time = Timer - start_transaction - api_time ' Create the transaction lr.set_transaction "StressServer", transaction_time, lr.PASS

