Share this page

# lr_resume_transaction_instance

Resumes reporting transaction instance data within a script.

    void lr_resume_transaction_instance( long trans_handle );

Alphabetical Listing - C Language Utility Functions

## Arguments

Name | Comments
--- | ---
trans_handle | The transaction instance ID that was returned by lr_start_transaction_instance

The lr_resume_transaction_instance function resumes the reporting of transaction data within the script that was suspended by lr_stop_transaction_instance. After a call to lr_stop_transaction_instance, statistics returned by the "get" Transaction Functions reflect only the data up to that call, until this function is called.

Data collection, however, is not interrupted. After the call to lr_resume_transaction_instance, the "get" functions return all data since the start of the transaction. Furthermore, the final results when the test is analyzed will reflect the total values, including the periods in between the transaction instance stop and resume.

If lr_resume_transaction_instance is not called, the final results reflect the statistics only until the call to lr_stop_transaction_instance.

The parent_handle is the value returned from the call to lr_start_transaction_instance that created the instance.

lr_stop_transaction_instance and lr_resume_transaction_instance can be used to conditionally collect information about either the beginning, or all of the transaction.

Note that you will not be able to differentiate in analysis between iterations when lr_stop_transaction_instance was called and iterations where it was not.

For more flexible ways recording transaction times conditionally, see lr_start_sub_transaction, lr_set_transaction, and lr_start_timer

## Return Values

No value is returned.

## Parameterization

You cannot use standard parameterization for any arguments in this function.

## Example

In the following example, lr_stop_transaction_instance and lr_resume_transaction_instance show the effect of stopping and resuming the instance.

Copy code

    Action() {
        int i;
        int iteration = 1000;
        char aStr[100];
        long trans_handle;
        /* The handle argument of zero indicates
            that there is no parent transaction */
        trans_handle = lr_start_transaction_instance("Stop&Start", 0);

        /* Do part of business process. Represented
            here by loop to ensure that some
            time passes. */
        for (i=0; i < iteration; ++i) {
            sprintf(aStr, "%d", i);
          //lr_log_message("%d",i);
        }
        /* Output the duration to this point
            with transaction instance active */
        lr_output_message("First time = %f",
            lr_get_trans_instance_duration(trans_handle));
        // Stop the transaction instance
        lr_stop_transaction_instance(trans_handle);
        /* Output the duration to this point
            with transaction stopped */
        lr_output_message("Immediately after stop = %f",
            lr_get_trans_instance_duration(trans_handle));
        // Ensure that some time passes
        for (i=0; i < iteration; ++i) {
            sprintf(aStr, "%d", i);
            //lr_log_message("%d",i);
        }
        /* Output the duration to this point
            with transaction instance still stopped but
            more time passed. Note that time is the same.
            The time spent in the loop while the transaction
            instance was stopped is not reported. */
        lr_output_message("After stop and loop = %f",
            lr_get_trans_instance_duration(trans_handle));
        // Resume the transaction instance
        lr_resume_transaction_instance(trans_handle);
        /* Note that with the instance resumed,
            all the time passed since the start is
            reported, including the time spent in the
            loop while the instance was stopped. */
        lr_output_message("After resume time = %f",
            lr_get_trans_instance_duration(trans_handle));
        // Add time to duration
        for (i=0; i < iteration; ++i) {
            sprintf(aStr, "%d", i);
            //lr_log_message("%d",i);
    }
        /* Total time reported */
        lr_output_message("After resume and loop = %f",
            lr_get_trans_instance_duration(trans_handle));
        // End transaction instance
        lr_end_transaction_instance(trans_handle, LR_AUTO);
        return 0;
    }

    Example: Output:
    Action.c(14): Notify: Transaction Stop&Start started.

    Action.c(26): First time = 0.609375
    Action.c(31): Notify: Transaction Stop&Start stopped.
    Action.c(36): Immediately after stop = 0.609375
    Action.c(50): After stop and loop = 0.609375
    Action.c(54): Notify: Transaction Stop&Start resumed.
    Action.c(60): After resume time = 1.250000
    Action.c(70): After resume and loop = 1.859375
    Action.c(75): Notify: Transaction Stop&Start ended with Pass status (Duration: 1.8594).

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