Share this page

# lr_user_data_point_instance_ex

Records a user-defined data sample and correlates it to a transaction instance.

    long lr_user_data_point_instance_ex( const char* sample_name, double value, long transaction_handle, int log_flag );

Alphabetical Listing - C Language Utility Functions

## Arguments

Name | Comments
--- | ---
sample_name | A string indicating the name of the sample type.
value | The value to record.
parent_handle | A transaction instance identifier with which to associate the data_point.
log_flag | Determines whether the data point should be logged or not: DP_FLAGS_NO_LOG (1) DP_FLAGS_STANDARD_LOG DP_FLAGS_EXTENDED_LOG (3)

The lr_user_data_point_instance_ex function is the same as lr_user_data_point_instance except for the additional parameter log_flag.

Logging means writing data to a file. lr_user_data_point_instance_ex enables you to write a data point to the Vuser log file. When run in VuGen, the output is output.txt

You may want to write the data point conditionally according to the importance of the data to be logged. It can either be part of a Standard level when only the most important information is logged or an Extended level, when fuller logging is required.

log_flag denotes the log level and correlates to the settings found in VuGen's Log runtime setting which specifies how the script handles logging to a file during script execution. If DP_FLAGS_EXTENDED_LOG is passed to lr_user_data_point_instance_ex then the data point is logged only when the Extended runtime Log setting is activate. If log_flag is DP_FLAGS_STANDARD_LOG then it will be logged only if the Standard setting is active. DP_FLAGS_NO_LOG indicates that this data point is never written to a log file.

## Return Values

This function returns 0 if it succeeds, and -1 if it fails to write the sampled data.

## Parameterization

All string arguments (char type) can be parameterized using standard parameterization.

## Example

The following segment checks the CPU every second and records the result.

In the following example, a user data point instance records the amount overdrawn on a bank account during a specific transaction instance whose id is instance_id. The data point's log flag is Extended and will be logged if VuGen's Log runtime setting is set at Extended level.

    int LIMIT=1000;
    long instance_id;
    int amount_overdrawn;
    amount_overdrawn = get_amount_overdrawn();
    while (amount_overdrawn < LIMIT) {
         /* Notify that a transaction is starting */
         instance_id = lr_start_transaction_instance("withdraw", 0);
         status = bank_withdraw(500); /* Call to server API */
         /* End transaction with operation result - pass or fail */
        if (status == 0)
              lr_end_transaction_instance(instance_id, LR_PASS);
         else
              lr_end_transaction_instance(instance_id, LR_FAIL);
         amount_overdrawn = get_amount_overdrawn();
         /* Record the amount overdrawn as a data point and associate it with
         * the specific transaction instance by using the instance's id */
         lr_user_data_point_instance_ex("Amount Overdrawn",
              (double)amount_overdrawn, instance_id,
              DP_FLAGS_EXTENDED_LOG);
    }

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: