Page 1 of 337

Command Line Parsing Functions

Click one of the following functions for more information:
HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > Command Line Parsing Functions

lr_get_attrib_double Returns the value of a double type command line parameter lr_get_attrib_long Returns the value of a long integer type command line parameter. lr_get_attrib_string Returns a command line parameter string.
Page 2 of 337

Informational Functions
Click one of the following functions for more information:
HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > Informational Functions

lr_end_timer Stops a timer. lr_get_host_name Returns the name of the host executing the script. lr_get_master_host_name Returns the name of the machine running the LoadRunner Controller . lr_get_vuser_ip Returns the IP address of the current Vuser. Not applicable for products that do not run Vusers. lr_start_timer Starts a timer. lr_user_data_point Records a user-defined data sample. lr_user_data_point_ex Records a user-defined data sample and enables logging option. lr_user_data_point_instance Records a user-defined data sample and correlates it to a transaction instance. lr_user_data_point_instance_ex Records a user-defined data sample and enables logging option. lr_whoami Returns information about a Vuser executing the script. Not applicable for products that do not run Vusers.
Page 3 of 337

Message Functions

Click one of the following functions for more information:
HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > Message Functions

lr_debug_message Sends a debug message to the LoadRunner output window or Application Management agent log file. lr_error_message Sends an error message to the LoadRunner output window or Application Management agent log file. lr_get_debug_message Returns the current message logging settings. lr_log_message Sends a message to the Vuser log file. lr_message Sends a message to the log file and output window. lr_output_message Sends a Vuser message to the log file and output window with location information. lr_set_debug_message Sets a message class for output messages. lr_vuser_status_message Sends a message to the Vuser status area in the LoadRunner Controller.
Page 4 of 337

Run-Time Functions

Click one of the following functions for more information:
HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > Run-Time Functions

lr_abort Aborts script execution. lr_continue_on_error Specifies an error handling method. lr_disable_ip_spoofing Disables IP Spoofing. lr_enable_ip_spoofing Enables IP Spoofing. lr_exit Exits from the script, action, or iteration. lr_load_dll Loads an external DLL. lr_param_increment Increments the value of a numerical parameter lr_peek_events Checks for events. lr_rendezvous Creates a rendezvous point in the Vuser script. lr_rendezvous_ex Sets a rendezvous point in a Vuser script. lr_think_time Pauses execution between commands in a script.
Page 5 of 337

String and Parameter Functions
Click one of the following functions for more information:
HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > String and Parameter Functions

lr_advance_param Advances to the next available value in the parameter data file. lr_checkpoint Validates the value of a parameter against an expected value (checkpoint). lr_convert_string_encoding Converts a string to a different encoding. lr_decrypt Decrypts an encoded string. lr_eval_string Returns the string argument after evaluating embedded parameters. lr_eval_string_ext Creates a buffer and assigns it the input string after evaluating embedded parameters. lr_eval_string_ext_free Frees the buffer allocated by lr_eval_string_ext. lr_next_row Advances to the next row in the parameter data file. lr_param_increment Increments the value of a LoadRunner parameter. lr_param_sprintf Writes formatted output to a parameter. lr_param_unique Generates a unique string and assigns it to a parameter. lr_paramarr_idx Returns the value of the parameter at a specified location in a parameter array. lr_paramarr_len Returns the number of elements in a parameter array. lr_paramarr_random Returns the value of the parameter at a random location in a parameter array lr_save_datetime Saves the date and time into a parameter. lr_save_int Saves an integer to a parameter. lr_save_searched_string Searches for an occurrence of a string in a buffer and saves a portion of the buffer after that string to a parameter. lr_save_string Saves a null terminated string as a parameter. lr_save_var Saves a variable length string as a parameter.
Page 6 of 337

Transaction Functions

Click one of the following functions for more information:
HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > Transaction Functions

lr_end_sub_transaction Marks the end of a sub-transaction.

lr_end_transaction Marks the end of a transaction. lr_end_transaction_instance Marks the end of a transaction instance. lr_fail_trans_with_error Sets the status of open transactions to LR_FAIL and sends an error message. lr_get_trans_instance_duration Returns the duration of a transaction instance specified by its handle. lr_get_trans_instance_status Returns the current status of a transaction instance. lr_get_trans_instance_think_time Gets the think time of a transaction instance specified by its handle. lr_get_trans_instance_wasted_time Gets the wasted time of a transaction instance by its handle. lr_get_transaction_duration Gets the duration of a transaction by its name. lr_get_transaction_status Gets the current status of a transaction. lr_get_transaction_think_time Gets the think time of a transaction by its name. lr_get_transaction_wasted_time Gets the wasted time of a transaction by its name. lr_resume_transaction Resumes collecting transaction data. lr_resume_transaction_instance Resumes collecting transaction instance data. lr_set_transaction Create a transaction manually. lr_set_transaction_instance_status Sets the status of a transaction instance. lr_set_transaction_status Sets the status of open transactions. lr_set_transaction_status_by_name Sets the status of a transaction. lr_start_sub_transaction Marks the beginning of a sub-transaction. lr_start_transaction Marks the beginning of a transaction. lr_start_transaction_instance Starts a nested transaction specified by its parent's handle. lr_stop_transaction Stops the collection of transaction data. lr_stop_transaction_instance Stops collecting data for a transaction specified by its handle. lr_wasted_time Removes wasted time from all open transactions.
Page 7 of 337

Database Functions
These database functions can only be used with the Web Services protocol. Click one of the following functions for more information:
HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > Database Functions

lr_db_connect Connects to a database. lr_db_disconnect Disconnects from a database. lr_db_executeSQLStatement Submits an SQL statement to a database. lr_db_dataset_action Performs an action on a dataset. lr_db_getValue Retrieves a value from a dataset. lr_db_dataset_action Validates database contents by setting checkpoints.
Page 8 of 337

Alphabetical Listing

Click one of the following functions for more information:
HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > Alphabetical Listing

lr_abort Aborts script execution. lr_advance_param Advances to the next available value in the parameter data file. lr_continue_on_error Specifies an error handling method. lr_convert_string_encoding Converts a string to a different encoding. lr_db_dataset_action Validates database contents by setting checkpoints. lr_db_connect Connects to a database. lr_db_dataset_action Performs an action on a dataset. lr_db_disconnect Disconnects from a database. lr_db_executeSQLStatement Submits an SQL statement to a database. lr_checkpoint Validates the value of a parameter against an expected value (checkpoint). lr_db_getValue Retrieves a value from a dataset. lr_debug_message Sends a debug message to the LoadRunner output or Application Management agent log file. lr_decrypt Decrypts an encoded string. lr_disable_ip_spoofing Disables IP Spoofing. lr_enable_ip_spoofing Enables IP Spoofing. lr_end_sub_transaction Marks the end of a sub-transaction. lr_end_transaction Marks the end of a LoadRunner transaction. lr_end_transaction_instance Marks the end of a transaction instance. lr_end_timer Marks the end of a sub-transaction. lr_error_message Sends an error message to theLoadRunner output or Application Management agent log file.. lr_eval_string Replaces a parameter with its current value. lr_eval_string_ext Creates a buffer and assigns it the input string after evaluating embedded parameters. lr_eval_string_ext_free Frees the buffer allocated by lr_eval_string_ext. lr_exit Exits from the script, action, or iteration. lr_fail_trans_with_error Sets the status of open transactions to LR_FAIL and sends an error message. lr_get_attrib_double Returns the value of a double type command line parameter. lr_get_attrib_long Returns the value of a long integer type command line parameter. lr_get_attrib_string Returns a command line parameter string. lr_get_debug_message Returns the current message logging settings.
Page 9 of 337

lr_get_host_name Returns the name of the host executing the script. lr_get_master_host_name Returns the name of the machine running the LoadRunner Controller. lr_get_transaction_duration Gets the duration of a transaction by its name. lr_get_transaction_status Gets the current status of a transaction. lr_get_trans_instance_duration Returns the duration of a transaction by its name. lr_get_trans_instance_status Returns the current status of a transaction instance.

lr_get_trans_instance_think_time Gets the think time of a transaction instance specified by its handle. lr_get_trans_instance_wasted_time Gets the wasted time of a transaction instance by its handle. lr_get_transaction_think_time Gets the think time of a transaction by its name. lr_get_transaction_wasted_time Gets the wasted time of a LaoadRunner transaction by its name. lr_get_vuser_ip Returns the IP address of the current Vuser. Not applicable for products that do not run Vusers. lr_load_dll Loads an external DLL. lr_log_message Sends a message to the Vuser log file. lr_message Sends a message to the output and log file. lr_output_message Sends a message to the output and log file with location information. lr_next_row Advances to the next row in the parameter data file. lr_param_increment Increments the value of a numerical parameter lr_param_sprintf Writes formatted output to a parameter. lr_param_unique Generates a unique string and assigns it to a parameter. lr_paramarr_idx Returns the value of the parameter at a specified location in a parameter array. lr_paramarr_len Returns the number of elements in a parameter array. lr_paramarr_random Returns the value of the parameter at a random location in a parameter array lr_peek_events Checks for events. lr_rendezvous Creates a rendezvous point in the Vuser script. lr_rendezvous_ex Sets a rendezvous point in a Vuser script. lr_resume_transaction Resumes the collection of transaction data. lr_resume_transaction_instance Resumes collecting transaction instance data. lr_save_datetime Saves the date and time into a parameter. lr_save_int Saves an integer to a parameter. lr_save_searched_string Searches for an occurrence of a string in a buffer and saves a portion of the buffer after that string to a parameter lr_save_string Saves a null-terminated string as a parameter. lr_save_var Saves a variable length string as a parameter. lr_set_debug_message Sets a message class for output messages.
Page 10 of 337

lr_set_transaction Create a transaction manually. lr_set_transaction_instance_status Sets the status of a transaction instance. lr_set_transaction_instance_status Sets the status of a transaction instance. lr_set_transaction_status Sets the status of open transactions. lr_set_transaction_status_by_name Sets the status of a transaction by its name. lr_start_transaction Marks the beginning of a transaction. lr_start_transaction_instance Marks the beginning of a transaction instance lr_start_sub_transaction Marks the beginning of a sub-transaction. lr_stop_transaction Halts the collection of transaction data. lr_stop_transaction_instance Stops collecting data for a transaction instance specified by its handle.

lr_whoami Returns information about a Vuser executing the script Page 11 of 337 lr_abort Aborts the execution of a script. lr_user_data_point_instance Records a user-defined data sample and correlates it to a transaction instance. executes the vuser_end section. When you end a run using this function. the status is "Stopped. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_advance_param Return Values Parameterization int lr_advance_param ( const char *param). lr_vuser_status_message Sends a message to the Vuser status area in the Controller. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_abort Return Values Parameterization void lr_abort( ). This function is useful when you need to manually abort a run as a result of a specific error condition.abort( ). lr_user_data_point_instance_ex Records a user-defined data sample and correlates it to a transaction instance.advance_param ( String parameter )." Page 50 of 337 lr_advance_param C Language Advances to the next available parameter value.advance_param ( ByVal parameter as string ) as integer Example See Also Visual Basic Syntax . Example See Also Java Syntax The lr_abort function aborts the execution of a script . Example See Also Java Language void lr. It stops the execution of the Actions section. lr_user_data_point Records a user-defined data sample. Example See Also Java Syntax Visual Basic function lr. lr_wasted_time Removes wasted time from all open transactions.lr_think_time Pauses execution between commands in a script. and ends the execution. Example See Also Java Language int lr. lr_user_data_point_ex Records a user-defined data sample.

Valid values: false: Steps do not fail. LAST). true: Steps fail. LAST This delimiter marks the end of the argument list. param The name of the parameter in quotes (no brackets). Can be a value or a LoadRunner parameter. Example See Also The lr_checkpoint function validates the value of a parameter against a checkpoint value. See the Example. This function is not recorded. Page 52 of 337 lr_continue_on_error . the script aborts or continues. StopOnValidationError Indication of whether all steps fail. Any text can be used. "ActualValue={<input_param>}".The lr_advance_param function causes the script to use the next available value of the parameter. "Compare=<operator>". as it appears in the test tree. "StopOnValidationError=<error_code>". Compare Operator used to compare the ActualValue and ExpectedValue values: Equals NotEquals Contains StartsWith EndsWith ExpectedValue Data to compare with the ActualValue argument. It can be added manually when enhancing the script. If you are running multiple iterations. Can be a value or a LoadRunner parameter. Operators are case-sensitive. If the validation fails. depending on the values of the StopOnValidationError argument and the Continue on Error? runtime setting. Use this function within an iteration to advance to the next value. The Continue on Error? runtime setting takes precedence over the value of StopOnValidationError. This function is not recorded—you insert it manually into your script. Page 51 of 337 lr_checkpoint Validates the value of a parameter against an expected value (checkpoint). StepName The name of the step. "ExpectedValue={<checkpoint>}". C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_checkpoint Return Values Parameterization int lr_checkpoint("StepName=<step_name>". ActualValue Data to compare with the ExpectedValue argument. you can specify in the parameter properties to advance automatically to the next value for each iteration. The effect on other parameters in the same data file depends on the settings in the Vuser parameter list dialog.

Example See Also The lr_continue_on_error function specifies how to handle errors. const char *paramName). Possi bl e val ues f or ' f r omEncodi ng' and ' t oEncodi ng' : sourceString The string to convert fromEncoding The encoding of the sourceString toEncoding The encoding to convert of the string saved in parameter paramName paramName The name of the parameter in which the destination string will be saved Constant Value LR_ENC_SYSTEM_LOCALE NULL LR_ENC_UTF8 "utf-8" LR_ENC_UNICODE "ucs-2" . or to abort the run execution. By default. you can use severity levels to control error handling for database operation errors in LoadRunner. by inserting the lr_continue_on_error function before and after the desired segment (see the example for details). in the parameter paramName. lr_convert_string_encoding is added manually to a script when needed. Example See Also lr_convert_string_encoding converts a string encoding between the following encodings: System locale. you specify how the test run component handles errors during script execution using the General section in VuGen's Runtime Settings dialog. However. const char *fromEncoding. value One of the Error Continuation Options. the script exits when an error occurs. and UTF-8. Unicode.Specifies an error handling method. you can control error handling for a specific segment of the script. To continue script execution even when errors occur. You can choose to continue running if an error occurs. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_continue_on_error Return Values Parameterization void lr_continue_on_error ( int value ). In addition to the lr_continue_on_error statements. select the Continue on Error check box in VuGen's Runtime Settings. Normally. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_convert_string_encoding Return Values Parameterization int lr_convert_string_encoding ( const char *sourceString. const char *toEncoding. The function saves the result string. Page 53 of 337 lr_convert_string_encoding Converts a string to a different encoding. It is not recorded. including its terminating NULL.

Select the Database: Connect option in the Add Step dialog box and enter the connection parameters. Add lr_db_connect to the vuser_init section of the script. When specifying the connection string for a specific SQL Server instance. to connect to an SQL Server. Adding this function to the Action section can increase performance overhead during load testing. escaping the backslashes in the path. Page 55 of 337 . Valid values are: SQL (meaning. Any text can be used. When specifying the connection string using SQL Server 2005 Express. Tip: Use the Connection Dialog to create a database specific connection string. such as lr_db_executeSQLStatement . as it appears in the test tree. Example See Also The lr_db_connection function establishs the database connection used by other database related functions. "ConnectionString=<connection_string>". I ni t i al Cat al og=myDat abase I d=myUser . The password cannot be encrypted. Passwor d=myPasswor d. For example: "Connect i onSt r i ng=Ser ver=soa-m16\ \ soa. ConnectionString A string indicating the database to which to connect and other information needed to establish the connection. StepName The name of the step.Dat abase=. ConnectionString could contain the value: Dat a Sour ce=mySer ver Addr ess. the Microsoft Native SQL Provider) OLEDB ODBC ORACLE LAST This delimiter marks the end of the argument list. "ConnectionType=<connection_type>". Note that the equal signs are part of the connection string. ConnectionName A logical name for the connection. use the server and instance name in the data source. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_db_connect Return Values Parameterization int lr_db_connect("StepName". The syntax for the connection string varies depending on the data provider specified with the ConnectionType argument. "ConnectionName=<connection_name>". . use the server name syntax <SQL Server 2005 Express installation>\SQLEXPRESS. . LAST). For example. ConnectionType Type of data provider.Page 54 of 337 lr_db_connect Connects to a database.

StepName The name of the step. PRINT: Prints the contents of the entire dataset to the Replay Log and other test report summaries. or prints the dataset to the Replay Log. Action The action to perform on the dataset: RESET: Set the cursor to the first record of the dataset. Page 57 of 337 lr_db_executeSQLStatement Submits an SQL statement to a database. Add lr_db_disconnect to the vuser_end section of the script. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_db_executeSQLStatement Return Values Parameterization int lr_db_executeSQLStatement("StepName=<step_name>". StepName The name of the step. "DatasetName=<dataset_name>". DatasetName Logical name for the dataset specified in lr_db_executeSQLStatement . . "Action=<action>". as it appears in the test tree. "ConnectionName=<connection_name>". Adding this function to the Action section can increase performance overhead during load testing. Any text can be used. The total number of records is also listed.lr_db_dataset_action Performs an action on a dataset. You must call lr_db_disconnect for each connection established by lr_db_connect to terminate the connection. Any text can be used. Page 56 of 337 lr_db_disconnect C Language Disconnects from a database. Example See Also The lr_db_dataset_action function sets the cursor to the first record of the dataset. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_db_disconnect Return Values Parameterization int lr_db_disconnect("StepName=<step_name>". Example See Also The lr_db_disconnect function disconnects a database connection. REMOVE: Releases the memory allocated for the dataset. LAST). removes it from memory. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_db_dataset_action Return Values Parameterization int lr_db_dataset_action("StepName=<step_name>". LAST This delimiter marks the end of the argument list. as it appears in the test tree. only the first one hundred records are listed in the test report summaries. LAST This delimiter marks the end of the argument list. LAST). ConnectionName The logical name for the connection specified in lr_db_connect . When printing a dataset.

In this case. as it appears in the test tree. Example See Also The lr_db_executeSQLStatement submits an SQL statement to a database. The data in the dataset can be manipulated by subsequent steps in the script. . INSERT. "Row=<row>". LAST)."ConnectionName=<connection_name>". DatasetName Logical name for the dataset specified in lr_db_executeSQLStatement . DELETE. When this function reaches the last row of the dataset. the row is undefined. "OutParam=<output_parm>". such as SELECT. If Row=next is specified the next time lr_db_getValue is called. In this context. "Column=<column>". the row is undefined. Column The name of the column in the dataset from which to retrieve the value. DatasetName points to the resulting dataset. StepName The name of the step. as it appears in the test tree. INSERT. When SQLStatement is either DELETE. by which you can refer to the dataset in subsequent steps. StepName The name of the step. "DatasetName=<dataset_name>". After calling this function. the script continues to the first record without issuing any errors. DatasetName Logical name for the resulting dataset from the SQL query. and UPDATE. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_db_getValue Return Values Parameterization int lr_db_getValue("StepName=<step_name>". the term dataset is used to describe tables of data (formatted as rows and columns). Example See Also The lr_db_getValue function retrieves a value from the dataset created by an lr_db_executeSQLStatement. For use only when SQLStatement is a SELECT statement.] LAST). Any text can be used. The syntax is database-dependent. Page 58 of 337 lr_db_getValue Retrieves a value from a dataset. This function does not support the print or output of binary data. LAST This delimiter marks the end of the argument list. make sure to set Row to next or 1 if calling lr_db_getValue after this function. When SQLStatement is a SELECT statement. SQLStatement can be parameterized. or UPDATE. Binary values retrieved from the dataset appear as <binary_data>. ConnectionName The logical name for the connection specified in lr_db_connect . a warning is issued to the Replay Log and the test results summary. SQLStatement The SQL statement. ["DatasetName=<dataset_name>". "SQLStatement=<statement>". Any text can be used.

the message is not issued. message_level One of the Message Log Run-Time Settings. If any one of the levels are active (from the UI). .sets the cursor to the next row OutParam The LoadRunner parameter that will contain the value. Example See Also Java Syntax Visual Basic function lr. Example See Also Java Language int lr. One of: The row number (1-based) current . Page 59 of 337 lr_debug_message Sends a debug message to the log file. If the specified message level is not active. The message is sent to the output window. If none of the levels are active. use lr_get_debug_message. Note that you can also specify multiple message levels with an OR separator ("|").debug_message ( int message_level.Row Sets the dataset cursor to the specifed row before fetching data. ByVal message as string ) as Integer Example See Also Visual Basic Syntax The lr_debug_message function sends a debug message when the specified message level is active. const char *format. format A formatted string which is the message to be sent to the log file. To determine the current level. String message ).debug_message ( ByVal message_level as Integer.. Disabled does not apply. ). C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_debug_message Return Values Parameterization int lr_debug_message (unsigned int message_level. a message is not issued.does not move the cursor next .. To display the debug messages in the LoadRunner output window or Application Management agent log file. You may use the standard Message Formatting that is available for printf. Page 60 of 337 . use the Expert Mode Settings. the message is issued to the Output window. LAST This delimiter marks the end of the argument list. Activate Expert Mode (Tools > Expert Mode) and then choose Tools > Options > Debug Information and select the General check box. You can set the active message level to MSG_CLASS_BRIEF_LOG or MSG_CLASS_EXTENDED_LOG from the user interface or by using lr_set_debug_message.

not including the quote marks themselves. The encrypted string appears in the Encoded string box. even when you use the same password. It is possible to create an lr_decrypt call from a recorded value in the script. Paste the value into the Password field. EncodedString The encoded string you want to decrypt. Page 61 of 337 lr_disable_ip_spoofing Disables IP Spoofing C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_disable_ip_spoofing Return Values Parameterization int lr_disable_ip_spoofing ( ). VuGen uses 32 bit encryption. Then run Start > Programs > LoadRunner > Tools > Password Encoder. Select an entire string between quote marks. and click Generate. then paste the encryped string into a parameter for later use.decrypt ( String EncodedString ). Each time you record. copy the recorded value. To get an encryped value from a recorded value for later use. This function is generated during recording to encode passwords. Example See Also Java Language String lr. Example See Also Java Syntax Visual Basic function lr.decrypt ( ByVal EncodedString as String ) as String Example See Also Visual Basic Syntax The lr_decrypt function decrypts an encoded string. When you run the script. or assign the value to a string variable. VuGen encrypts the password differently. Page 62 of 337 . VuGen records the actual password but displays an encoded version of the password within the lr_decrypt function. Click the Copy button. Right-click in the selected string and choose the ENCRYPT STRING option. the test run component decrypts the password.lr_decrypt Decrypts an encoded string C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_decrypt Return Values Parameterization char *lr_decrypt (const char *EncodedString). The original string is replaced with an lr_decrypt call where the EncodedString argument is the original string after encoding. Example See Also lr_disable_ip_spoofing disables IP spoofing during a script run.

NET or C#. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_end_sub_transaction Return Values Parameterization int lr_end_sub_transaction (const char *sub_transaction. Example See Also Use lr.end_sub_transaction ( sub_transaction as String. VB. Page 63 of 337 lr_enable_ip_spoofing Enables IP Spoofing C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_enable_ip_spoofing Return Values Parameterization int lr_enable_ip_spoofing ( ).empty to pass an Empty variant to a function that requires a Variant argument.) > lr. Example See Also Java Language int lr.empty () as Variant. Example See Also lr_enable_ip_spoofing enables IP spoofing during a script run. status as Integer ) as Integer Example See Also Visual Basic Syntax The lr_end_sub_transaction function marks the end of a sub-transaction. To mark the beginning of the sub-transaction. Example See Also VB Script Function lr. int status ). Multiple sub-transactions can be nested within a parent transaction. Page 64 of 337 lr_end_sub_transaction Marks the end of a sub-transaction. use the lr_start_sub_transaction function. use the class or keyword Empty. but each . You insert these functions immediately before and after the sub-transaction steps.empty Returns an Variant whose value is Empty. Example See Also Java Syntax Visual Basic function lr. In Visual Basic.end_sub_transaction ( String sub_transaction.lr. int status ). Java Script HP LoadRunner Online Function Reference > Utility Functions: Java Language (lr.empty Return Values Parameterization Variant lr.empty ().

end_transaction ( String transaction_name. int status ) . The resolution depends on the run-time environment. sub_transaction A string indicating the name of an existing sub-transaction. status The transaction status. and the lr_end_transaction function after the transaction. Page 65 of 337 lr_end_timer Stops a timer. You can manually set the status of the transaction or you can allow the script to detect it automatically.end_transaction ( ByVal transaction_name as string. To indicate a transaction to be analyzed. int status ). For the "succeed" return code. The maximum resolution is a microsecond. you perform a manual check within the code of your script (see example) evaluating the return code of a function. Example See Also Java Syntax Visual Basic function lr. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_end_transaction Return Values Parameterization int lr_end_transaction (const char *transaction_name. Page 66 of 337 lr_end_transaction Marks the end of a transaction. timer The handle of the timer returned by lr_start_timer. It returns the elapsed time in seconds. set the status . To manually set the status. Example See_Also lr_end_timer stops a timer that began timing when lr_start_timer was called. ByVal status as Integer ) as Integer Example See Also Visual Basic Syntax The lr_end_transaction function marks the end of a transaction and records the amount of time it took to perform the transaction. place the lr_start_transaction function before the transaction. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_end_timer Example Return Values Parameterization See Also double lr_end_timer (merc_timer_handle_t timer).lr_end_sub_transaction statement must match an lr_start_sub_transaction statement or it will be interpreted as an illegal command. Example See Also Java Language int lr.

For an "aborted" return code. set the status to LR_STOP. For a "fail" return code. and the lr_end_transaction_instance function after the transaction. Example See Also The lr_end_transaction_instance function marks the end of a transaction instance and records the amount of time it took to perform the transaction. this value is LR_PASS signifying a successful transaction. transaction_name A string indicating the name of an existing transaction. set the transaction status to LR_PASS. The script returns the detected. set the status to LR_FAIL. Page 68 of 337 lr_error_message . then it is the last call before lr_end_transaction which effectively changes the status. To instruct the script to automatically detect the status. if prior to lr_end_transaction. then this is the value which is passed as status in lr_end_transaction. set the status to LR_STOP. you perform a manual check within the code of your script (see example) evaluating the return code of a function. status The Transaction Status Page 67 of 337 lr_end_transaction_instance Marks the end of a transaction instance. lr_set_transaction_status_by_name. specify LR_AUTO. lr_set_transaction_instance_status or lr_fail_trans_with_error. int status ). If status is LR_AUTO. To indicate a transaction instance to be analyzed. If you make a series of calls to functions that modify the LR_AUTO status. you change the default value using lr_set_transaction_status. status The transaction status. For the "succeed" return code. For a "fail" return code. For an "aborted" return code. place the lr_start_transaction_instance function before the transaction. parent_handle The handle returned by lr_start_transaction_instance at the creation of the instance. then the value of status is automatically assigned. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_end_transaction_instance Return Values Parameterization int lr_end_transaction_instance (long parent_handle. set the status to LR_FAIL.to LR_PASS. However. By default. To manually set the status. You can manually set the status of the transaction instance or you can allow the script to detect it automatically.

then create a transaction to report the time with lr_set_transaction. It is not recommended that you send a message to the Output window in the middle of a transaction. If you want to save the elapsed time in spite of the transaction failure.. use lr_message. For details regarding the output for each product..error_message ( ByVal message as String ) as Integer Example See Also Visual Basic Syntax The lr_error_message function sends an error message to product output windows (such as the LoadRunner output window). log files. Note that this function sends a message to the output even when logging is disabled in the run-time settings. You may specify a literal string in quotation marks or use the standard Message Formatting that is available for printf. To send a special notification that is not specifically an error message. This conserves the resources required for sending messages to the VuGen displays the message text of the lr_error_message function in the Execution log in red. message format C Language A formatted string to send to the Output window. . using Error code 17999. exp2. int lr_error_message (const char *format. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_error_message Return Values Parameterization Example See Also Java Language int lr. Instead..expn. see the products' user guides. log files (such as Vugen and the Application Management agent log file). In the Vuser Execution log. and other test report summaries. this function lists the location and line number from where the message was issued. and other test report summaries. If Run-time settings > General > Miscellaneous > Fail open transactions on lr_error_message is selected. as it will lengthen the execution time. To issue a message without those details. use lr_log_message to send the message only to the Vuser log file. use lr_output_message.Sends an error message with location details to the output windows. calling lr_error_message will fail the transaction in addition to sending the message. Out put of l r _er r or _message( " out put message" ) . ). exp1. .Act i on( 4) : out put message Out put of l r _message( "message" ) . capture the time with lr_get_transaction_duration before calling lr_error_message. Example See Also Java Syntax Visual Basic function lr.error_message ( String message ).

C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_eval_string Return Values Parameterization char *lr_eval_string (const char *instring ). message Java and Visual Basic A string containing the error message to send to the Output window. param_name The parameter to evaluate.eval_long (ByVal param_name as String ) as long Example See Also Visual Basic Syntax The lr.eval_double Returns the double value of the parameter.eval_long Return Values Parameterization function lr.eval_double function lr. Page 69 of 337 Page 70 of 337 lr. See VB String Arguments and Java String Arguments. exp 2 .) > lr. Visual Basic and VB Script Return Values Parameterization HP LoadRunner Online Function Reference > Utility Functions: VB. Example See Also Java Language String lr.eval_string ( String instring ). Page 71 of 337 lr...eval_double (ByVal param_name as String ) as Double Example See Also Visual Basic Syntax The lr. .eval_double function returns the value of the parameter as a double param_name The parameter to evaluate. VB Script (lr.eval_long function returns the value of the parameter as a Long. VB Script (lr.) > lr. Page 72 of 337 lr_eval_string Returns the string argument after evaluating embedded parameters. exp n C Language The expressions or variables to be formatted.eval_long Returns the long value of the parameter. Visual Basic and VB Script HP LoadRunner Online Function Reference > Utility Functions: VB.exp 1 .

Instead. 5 After using lr_eval_string_ext. unsigned long const options. The memory is freed at the end of each iteration. Note: lr_eval_string allocates memory internally. long const line ). data with embedded NULL characters.Example See Also Java Syntax Visual Basic function lr. unsigned long const in_len. unsigned long * const out_len. Using lr_eval_string in a loop uses more memory. use lr_eval_string_ext and free the memory in each loop iteration with lr_eval_string_ext_free. and not the length of the value of the parameter. const char *file.eval_string (ByVal instring as String ) as String Example See Also Visual Basic Syntax The lr_eval_string function returns the input string after evaluating any embedded parameters. Example See Also The lr_eval_string_ext function evaluates in_str by replacing parameters with their string value. in_str The string to be evaluated. char ** const out_str. if parameter ABC contains the string "1234567890". For example. This function is useful when correlating statements that use binary data. Note that in_len is the length of the argument you pass. instring The string to evaluate. If the string argument contains only a parameter. the call is: l r _eval _s t r i ng_ext ( "{ABC}" . It creates a buffer containing the expanded string and sets out_str to point to that buffer. Use this function in conjunction with lr_eval_string_ext_free in preference to lr_eval_string when evaluating strings in a loop. free the memory allocated for the output buffer with lr_eval_string_ext_free. the function returns the current value of the parameter. conserve memory by not using lr_eval_string . C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_eval_string_ext Return Values Parameterization int lr_eval_string_ext (const char *in_string. . It also assigns the length of the buffer to out_len. If you evaluate a parameter or parameters in a loop. Page 73 of 337 lr_eval_string_ext Creates a buffer and assigns it the input string after evaluating embedded parameters. for example. Embedded parameters must be in brackets.

The controller's Scenario Groups Status box displays the status. int exit_status). . Currently set to "0". If lr_exit is called several times in the same script.in_len The length of the name of argument in_str +2 to account for the parentheses. file Reserved for future use. it is the exit status of the last call that determines the status of the Vuser group running the script. whether in different actions or different iterations. A transaction in which lr_exit is called does not appear in the LoadRunner controller in the Transaction Status box. line Reserved for future use. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_exit Return Values Parameterization void lr_exit (int continuation_option. Currently set to "0". Currently set to "-1". Example See Also Java Language void lr. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_eval_string_ext_free Return Values Parameterization void lr_eval_string_ext_free (const char **param). Page 74 of 337 lr_eval_string_ext_free Frees the buffer allocated by lr_eval_string_ext. Page 75 of 337 lr_exit Exits from the script. action. or iteration. It is the column in which the group appears after the run stops. Example See Also The lr_eval_string_ext_free function frees the memory allocated by lr_eval_string_ext . out_len The length of the output buffer. options Reserved for future use. It is ignored in the count of passed and failed transactions. param A pointer to the buffer. continuation_option The continuation option specifies how the script continues after the call to lr_exit exit_status The status of the scenario group as a result of calling lr_exit Page 76 of 337 lr_fail_trans_with_error Sets the default status of open transactions to LR_FAIL and sends an error message. int exit_status).exit (int continuation_option. out_str A pointer to the output buffer. Example See Also Java Syntax The lr_exit function allows you to exit from the script run during execution.

..get_attrib_double ( String parameter ).. The lr_fail_trans_with_error function sets the default exit status to LR_FAIL for all open transactions with LR_AUTO in their lr_end_transaction statement and sends an error message.). If it is a literal string. exp1. exp n The optional expressions (variables) to be formatted and printed. Page 77 of 337 lr_get_attrib_double C Language Return Values Parameterization Returns a value of the calling mdrv command's parameter as a double. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_attrib_double double lr_get_attrib_double (const char *parameter).. exp 2 .. exp n .. By default the value assigned is LR_PASS. Use the format and exp parameters in the same way as the standard Message Formatting that is available for printf. exp 2 . . If this status is LR_AUTO. exp 1 .C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_fail_trans_with_error Example Return Values Parameterization See Also int lr_fail_trans_with_error (const char *format. exp2. The message is sent to the LoadRunner output window or Application Management agent log file.expn. A transaction's final status is defined in the status parameter of the lr_end_transaction statement. Example See Also Java Language double lr.. enclose it with quotation marks. lr_fail_trans_with_error changes this default value to LR_FAIL. format A string describing the format to use to write the optional remaining expressions exp 1 . You may specify a literal string in quotation marks or use the standard Message Formatting that is available for printf. which signifies a successful transaction. then the value is automatically assigned.

Example See Also Java Syntax Visual Basic function lr.get_attrib_long ( ByVal parameter as String ) as long Example See Also Visual Basic Syntax The lr_get_attrib_long function returns the value of a command line parameter whose type is long integer when the script is run using the mdrv command. see the HP LoadRunner Virtual User Generator User Guide. For more information on the running scripts using the mdrv command line. You place the command line parameter's name in the function's argument field and lr_get_attrib_double returns the value of that parameter. The function returns NULL if the mdrv command line was not used to run the script (for example.get_attrib_double ( ByVal parameter as String ) as double Example See Also Visual Basic Syntax The lr_get_attrib_double function returns the value of a command line parameter whose type is a double precision floating point when the script is run using the mdrv command. For more information on the running scripts using the mdrv command line. see the HP LoadRunner Virtual User Generator User Guide. the script was run directly in VuGen or by LoadRunner). You place the command line parameter name in the function's argument field and lr_get_attrib_long returns the value of that parameter. parameter The name of a parameter which can be interpreted as a double value. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_attrib_long Return Values Parameterization long lr_get_attrib_long (const char *parameter). Page 78 of 337 lr_get_attrib_long C Language Returns a value of the calling mdrv command's parameter as a long integer. Page 79 of 337 .get_attrib_long ( String parameter ). The function returns NULL if the mdrv command line was not used to run the script (for example. the script was run directly in VuGen or by LoadRunner).Example See Also Visual Basic function lr. The Command Line Parsing Functions functions eliminate the need to parse the command line manually. The Command Line Parsing Functions functions eliminate the need to parse the command line manually. parameter The name of a parameter which can be interpreted as a double value. Example See Also Java Language long lr.

get_attrib_string ( String parameter ). Page 80 of 337 lr_get_debug_message C Language Return Values Parameterization Returns the current message logging settings. The settings determine what information is sent output. argument A command line argument whose value is a string. For more information on the running scripts using the mdrv command line. Example See Also Java Language int lr.lr_get_attrib_string Returns a value of the calling mdrv command's parameter as a string. see the HP LoadRunner Virtual User Generator User Guide. the script was run directly in VuGen or by LoadRunner). The function returns NULL if the argument you specify is invalid. You place the argument name in the function's argument field and lr_get_attrib_string returns the string values associated with that argument. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_attrib_string Return Values Parameterization char *lr_get_attrib_string (const char *argument). The Command Line Parsing Functions functions eliminate the need to parse the command line manually. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_debug_message unsigned int lr_get_debug_message ( ). Example See Also Java Syntax Visual Basic function lr.get_debug_message ( ). . The log settings are specified with the run-time settings dialog.get_attrib_string ( ByVal parameter as String ) as String Example See Also Visual Basic Syntax The lr_get_attrib_string function returns a command line argument string when the script is run using the mdrv command. The function returns NULL if the mdrv command line was not used to run the script (for example. This is useful for checking if a command line option or a specific value is valid.get_debug_message ( ) as Integer Example See Also Visual Basic Syntax The lr_get_debug_message function returns the current log run-time settings . Example See Also Java Language String lr. or by using the lr_set_debug_message function. Example See Also Java Syntax Visual Basic function lr.

Example See Also Java Language String lr. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_host_name Return Values Parameterization char *lr_get_host_name ( ).get_master_host_name ( ). This allows you to determine which options are set. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_transaction_duration Return Values Parameterization . See the C syntax example. Example See Also Java Syntax Visual Basic function lr.get_master_host_name ( ) as String Example See Also Visual Basic Syntax The lr_get_master_host_name function returns the name of the machine running the Controller . To evaluate the returned value. Page 82 of 337 lr_get_master_host_name Returns the name of the Controller host.get_host_name ( ) as String Example See Also Visual Basic Syntax The lr_get_host_name function returns the name of the machine executing the script. Example See Also Java Language String lr. Not applicable for products that do not run Vusers.get_host_name ( ). you can perform a bitwise AND operation. Page 81 of 337 lr_get_host_name Returns the name of the host. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_master_host_name Return Values Parameterization char *lr_get_master_host_name ( ). Example See Also Java Syntax Visual Basic function lr.The debug messages are sent to the LoadRunner output window or Application Management agent log file. Page 83 of 337 lr_get_transaction_duration Returns the duration of a transaction.

Page 84 of 337 lr_get_transaction_status Returns the current status of a transaction. transaction_name The name of the transaction. it cannot report the final transaction status. Example See Also Visual Basic function lr. you can prevent unnecessary activity. By checking the status and terminating the Vuser. such as think time and wasted time. This function can be useful when a transaction. Example See Also Visual Basic . C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_transaction_think_time Return Values Parameterization double lr_get_transaction_think_time (const char *transaction). transaction A string indicating the name of a transaction. the value may be slightly greater than the duration reported for the function when closed with lr_end_transaction. To determine other transaction statistics. Since lr_get_transaction_status can only return the status of an open transaction. Page 85 of 337 lr_get_transaction_think_time Returns the think time of a transaction.double lr_get_transaction_duration (const char *transaction). Therefore. Example See Also lr_get_transaction_status returns the current status of a transaction. You use this function to determine the total transaction time before the transaction has ended. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_transaction_status Return Values Parameterization int lr_get_transaction_status ( const char *transaction_name ) . lr_get_transaction_duration returns values greater than zero only for open transactions. This function returns the duration including Wasted Time.get_transaction_duration ( String transaction ) as double Example See Also Visual Basic Syntax The lr_get_transaction_duration function returns the duration in seconds of the specified transaction to this point. lr_get_transaction_status cannot be invoked after lr_end_transaction. which is made up of a number of steps. use the Transaction Functions. can fail at various points.

The lr_get_transaction_wasted_time function returns values greater than zero only for open transactions. It returns values greater than zero only for open transactions. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_transaction_wasted_time double lr_get_transaction_wasted_time (const char *transaction). Page 86 of 337 lr_get_transaction_wasted_time C Language Return Values Parameterization Returns the wasted time of a transaction by its name. To determine other transaction statistics. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_trans_instance_duration Return Values Parameterization double lr_get_trans_instance_duration (long trans_handle). such as think time and wasted time. Use this function to determine the total transaction time before the transaction has ended. such as think time and wasted time.get_transaction_think_time ( String transaction ) as double Example See Also Visual Basic Syntax The lr_get_transaction_think_time function returns the think time of the specified transaction until this point. With lr_get_transaction_duration. transaction The name of the transaction. use the appropriate Transaction Functions.function lr. use the appropriate Transaction Functions. The trans_handle is the return value of a call to lr_start_transaction_instance . transaction The transaction name . The difference between this function and lr_get_transaction_duration is that here you specify a transaction instance by its handle. Page 87 of 337 lr_get_trans_instance_duration Returns the duration of a transaction instance. Example See Also The lr_get_transaction_wasted_time function returns the Wasted Time in seconds of the specified transaction to this point. . Example See Also The lr_get_trans_instance_duration function returns the duration of an open transaction instance in seconds until this point. To determine other transaction statistics. you specify an independent transaction by its name.

such as think time and wasted time. you can prevent unnecessary activity. With lr_get_transaction_think_time. The lr_get_trans_instance_think_time function returns values greater than zero only for open . use the appropriate Transaction Functions. Example See Also The lr_get_trans_instance_think_time function returns the think time of the specified transaction until this point. Page 89 of 337 lr_get_trans_instance_think_time Returns the think time of a transaction instance specified by its handle. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_trans_instance_think_time Return Values Parameterization double lr_get_trans_instance_think_time (long trans_handle). trans_handle A transaction handle. The transaction_handle is the handle returned by the call to lr_start_transaction_instance that created the instance. This function can be useful when a transaction instance. Example See Also lr_get_trans_instance_status returns the current status of a transaction instance. The trans_handle is the handle returned by the call to lr_start_transaction_instance that created the instance. To determine other transaction statistics. can fail at various points of its execution. which is made up of a number of steps. lr_get_trans_instance_status cannot be invoked after lr_end_transaction_instance .lr_get_trans_instance_duration returns values greater than zero only for open transactions. The difference between this function and lr_get_transaction_think_time is that here you specify a transaction instance by its handle. transaction_handle The name of the transaction. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_trans_instance_status Return Values Parameterization int lr_get_trans_instance_status ( long transaction_handle ) . By checking the status and terminating the Vuser. It cannot report the final transaction instance status. Page 88 of 337 lr_get_trans_instance_status Returns the current status of a transaction instance. you specify an independent transaction by its name.

such as think time and wasted time. To determine other transaction statistics. trans_handle A transaction handle. use the appropriate Transaction Functions. Example See Also Visual Basic function lr. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_vuser_ip Return Values Parameterization char *lr_get_vuser_ip( ). C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_trans_instance_wasted_time Return Values Parameterization double lr_get_trans_instance_wasted_time (long trans_handle). Example See Also The lr_get_trans_instance_wasted_time function returns the Wasted Time of the specified transaction until this point. .transactions. Page 90 of 337 lr_get_trans_instance_wasted_time Returns the wasted time of a transaction instance. The lr_get_trans_instance_think_time function returns values greater than zero only for open transactions. each Vuser can use a different address. you specify an independent transaction by its name.get_vuser_ip() as String Example See Also Visual Basic Syntax The lr_get_vuser_ip function returns the IP address of a Vuser. The trans_handle is the handle returned by the call to lr_start_transaction_instance that created the instance. The difference between this function and lr_get_transaction_wasted_time is that here you specify a transaction instance by its handle. Page 91 of 337 lr_get_vuser_ip Returns the IP address of a Vuser. To determine other transaction statistics. trans_handle A transaction handle. With lr_get_transaction_wasted_time. When performing IP spoofing. use the appropriate Transaction Functions. This function allows you to determine the current Vuser's IP address. such as think time and wasted time.

On UNIX platforms. lr_get_vuser_ip returns that IP. Page 92 of 337 lr_load_dll C Language Loads an external DLL. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_log_message Return Values Parameterization int lr_log_message (const char *format.If the IP was set with the web_set_sockets_option function using the IP_ADDRESS_BY_INDEX option.. LoadLibrary . HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_load_dll Return Values Parameterization int lr_load_dll (const char *library_name ).expn. Once you load the DLL. and not to the output window.).log_message ( ByVal message as String ) as Integer Example See Also Visual Basic Syntax The lr_log_message function sends a message to the Vuser or agent log file (depending on the application). Page 93 of 337 lr_log_message C Language Sends a message to the Application Management agent log file or the LoadRunner Vuser log. if you do not specify a path. you can call any function defined in the DLL. without having to declare it. You can specify a full path for the DLL. see the man pages for dlopen or its equivalent. Example See Also The lr_load_dll function loads a DLL (Windows) or shared object (UNIX) allowing you to call an external function when replaying using the C interpreter. you can set the LD_LIBRARY_PATH environment variable (or the platform equivalent).. Example See Also Java Syntax Visual Basic function lr. lr_load_library searches for the DLL using the standard sequence used by the C++ function. For more information. Example See Also Java Language int lr.. You can avoid overloading the network by using this function to send messages to the log file rather .log_message ( String message ). The lr_load_dll function uses the same search rules as dlopen. library_name The name of a DLL (Windows) or shared object (UNIX). exp2. On Windows platforms. You can use this function for debugging by sending error or other informational messages to the log file. exp1.

exp1. use lr_output_message. and select Always send messages. In a standalone program such as VuGen.txt. In the Vuser Execution log. exp2. exp1. To send a message to the output file. expn C Language The expressions (variables) to be formatted and printed. message Object oriented languages A string containing the message to send to the log.txt. lr_log_message sends the message to the viewer and output. statement Output lr_log_message("a message") a message lr_output_message("message").. If it is a literal string.message ( ByVal message as String ) as Integer Example See Also Visual Basic Syntax The lr_message function sends a message to the log file and output window. you must enable logging in the run-time settings. there is no output from this function.. See VB String Arguments and Java String Arguments.than sending messages to the Output window (with lr_error_message or lr_output_message).. Use the standard Message Formatting that is available for printf to set the format for the expressions you want to print. exp2. Action(4): a message Page 94 of 337 lr_message C Language Sends a message to the log and output window. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_message Return Values Parameterization int lr_message (const char *format. this function does not list the location and line number from where the message was issued. To issue a message with those details. Example See Also Java Syntax Visual Basic function lr.. . format C Language A formatted string to send to the log file. When run in VuGen.). This conserves the network and controller resources required for sending messages to the output. the output file is output. enclose it with quotation marks.expn. Use lr_log_message instead of this function to send the message only to the log file. Example See Also Java Language int lr.message ( String message ).. If you select Send messages only when an error occurs.

missing Return Values Parameterization Variant lr. format C Language A formatted string. you must enable logging in the run-time settings.empty to pass an Missing variant to a function that requires a Variant argument. In Visual Basic. In the log file.To send a message to the output file.) > lr. If you select Send messages only when an error occurs. and select Always send messages. message Object oriented A string containing the message to send to the Output window. use the class or keyword MISSING.. Use the standard Message Formatting that are available for printf to set the format for the expressions you want to print. VB. Action(4): a message Page 95 of 337 lr. there is no output from this function. . enclose it with quotation marks. If it is a literal string.missing () as Variant. exp 2 . Page 96 of 337 lr_output_message C Language Sends a message to log files..missing (). exp 1 . See VB String Arguments and Java String Arguments. exp n C Language The expressions (variables) to be formatted and printed. statement Output lr_message("a message") a message lr_output_message("a message"). HP LoadRunner Online Function Reference > Utility Functions: Java Language (lr. Example See Also Use lr. Example See Also VB Script Function lr.NET or C#. and other test report summaries. To issue a message with those details. output windows.missing Java Script Returns an Variant whose value is Missing. this function does not list the location and line number from where the message was issued. use lr_output_message.

. exp 1 . If you select Send messages only when an error occurs. Example See Also Java Language int lr. the output file is output. exp n C Language The expressions (variables) to be formatted and printed. message Object Oriented A string containing the message to send to the Output window... use lr_message.output_message ( ByVal message as String ) as Integer Example See Also Visual Basic Syntax The lr_output_message function sends a message with the script section and line number to output windows (such as the LoadRunner output window). exp1. It is not recommended that you send a message to the output window or agent log in the middle of a transaction. For details regarding the output for each product. Use the standard Message Formatting that is available for printf to set the format for the expressions you want to print... Example See Also Java Syntax Visual Basic function lr. and other test report summaries. To send a message to the Vuser execution log or Application Management Web site.output_message ( String message ). and select Always send messages.txt. format C Language A formatted string. enclose it with quotation marks. but not to the Output window. If it is a literal string.). you must enable logging in the run-time settings. To send an error message to the LoadRunner output window or Application Management agent log. When a script is run in VuGen. exp 2 . . exp2. See VB String Arguments and Java String Arguments. as it will lengthen the execution time.HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_output_message Return Values Parameterization int lr_output_message (const char *format. use lr_log_message. see the products' user guides. To issue a message without including the location details. there is no output from this function. use the lr_error_message function.expn. To send a message to the output file. log files (such as the Vugen log file and the Application Management Web site and agent log file).

Actions. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_paramarr_len Return Values Parameterization int lr_paramarr_len (const char * paramArrayName). Example See Also lr_paramarr_len returns the number of elements in a parameter array. paramArrayName. "{myParam_4}". "_". unsigned int index). paramArrayName The name of the parameter array from which to return the value. and "}". Example See Also lr_paramarr_random returns a string containing the value of the parameter in a parameter array. Example See Also lr_paramarr_idx returns a string containing the value of the parameter at the specified position in a parameter array. index The one-based position of the parameter in the array. If the parameter does not exist. lr_output_message("%s".statement Output lr. index. str).output_message("a message"). .g. Page 98 of 337 lr_paramarr_idx C Language Returns the value of the parameter at a specified location in a parameter array. char *str = NULL. paramArrayName The name of the parameter array. The value is returned from the parameter at a position chosen randomly by LoadRunner. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_paramarr_idx Return Values Parameterization char * lr_paramarr_idx ( const char * paramArrayName. for example.java (4): a message Page 97 of 337 Note: Do not send null pointers as arguments to string formats e. Page 99 of 337 lr_paramarr_len C Language Returns the number of elements in a parameter array. the return value is the concatenation of "{". Page 100 of 337 lr_paramarr_random Returns the value of the parameter at a random location in a parameter array C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_paramarr_random Return Values Parameterization char * lr_paramarr_random (const char * paramArrayName).log_message("a message") a message lr.

The value of source_param is restricted to the maximum value of a long integer minus 1. its value is overwritten. and %lle. . %ld. For protocols that have only string parameters. %hhi.paramArrayName The name of the parameter array. These formatting characters are not supported: %E. "%d" . %llf. l r _save_st r i ng( buf . ] ). %llu. "{modi f i cat i on_num}" ) . increment with C functions. destination_param The name of the parameter to store the incremented parameter source_param The name of the parameter whose value is incremented Page 102 of 337 lr_param_sprintf C Language Writes formatted output to a parameter. "next _modnum" ) . For protocols that have a numerical parameter. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_param_increment int lr_param_increment (const char *destination_param. Example See Also lr_param_sprintf functions like the standard C function sprintf except that the formatted string is written to a LoadRunner parameter instead of a string buffer. When destination_param exists. %lli. %hd. and stores the incremented value as a null terminated string in destination_param. i +1) . lr_param_increment can be used: l r _par am_i nc r ement ( "next _modnum" .args . const char * format [. Page 101 of 337 lr_param_increment C Language Return Values Parameterization Increments the value of a numerical parameter. For example: i = at oi ( l r _eval _st r i ng( "{modi f i cat i on_num}" ) ) . the parameter is created dynamically. Example See Also The lr_param_increment function retrieves the value of source_param. %hhe. %hhu . This function is useful only in protocols that have a numerical parameter type. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_param_sprintf Return Values Parameterization int lr_param_sprintf ( const char * paramName. spr i nt f ( buf . %lld. When it doesn't exist. %hhf .. increments its value by one. const char *source_param).. source_param's value should include only single-byte digit characters with an optional sign or leading zeros. source_param must be initialized with an integer value prior to calling lr_param_increment. %hhd.

Page 103 of 337 lr_param_unique C Language Generates a unique string and assigns it to a parameter. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_peek_events Return Values Parameterization void lr_peek_events ( ). Therefore. insert this function into your Vuser script at the point at which you want the Vuser to pause. there is no need to use the lr_peek_events function. Example See Also lr_param_unique generates a string of format: <GroupName><UserID><CurrentTime>.read_xml Returns the contents of an XML file as a string. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_param_unique Return Values Parameterization int lr_param_unique (const char * paramName). Your cannot use standard parameterization with this function. paramName The target parameter to which the string is written. Example See Also . args Optional print arguments.read_xml String. Scripts written in C language perform this check internally. Page 105 of 337 lr. Scripts written in Java or Visual Basic do not perform this check internally. Therefore. format One or more formatting characters.read_xml (String file_name).peek_events ( ). Example See Also Java Syntax Visual Basic sub lr.lr.paramName The target parameter to which the string is written. Page 104 of 337 lr_peek_events Checks for events. The string contains no spaces.) > lr.peek_events ( ) Example See Also Visual Basic Syntax The lr_peek_events function suspends the Vuser script run and checks for events before resuming. Java and Java Script HP LoadRunner Online Function Reference > Utility Functions: Java Language (lr. Example See Also Java Language void lr.

. and not in vuser_init or vuser_end.rendezvous ( ByVal rendezvous_name as String ) as Integer Example See Also Visual Basic Syntax The lr_rendezvous function creates a rendezvous point in a Vuser script. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_rendezvous_ex Return Values Parameterization int lr_rendezvous_ex (const char *rendezvous_name). Example See Also Java Syntax Visual Basic function lr. When this statement is executed. file_name The file to read and return as a string. Page 106 of 337 lr_rendezvous Creates a rendezvous point in the Vuser script. This function can only be used in action section. the Vusers stop and wait for permission from LoadRunner to continue. This function can only be used in an action section. The timeout is set in the scenario policy in the Controller. rendezvous_name The name of the rendezvous. the Vuser program stops and waits for permission from LoadRunner to continue. The file must exist in the data\SerializedObjects directory under the script directory. Example See Also The lr_rendezvous_ex function creates a rendezvous point in a Vuser script.read_xml function returns the contents of the specified file as a String. When this statement is executed. and not in vuser_init or vuser_end. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_rendezvous Return Values Parameterization int lr_rendezvous (const char *rendezvous_name).The lr. Page 107 of 337 lr_rendezvous_ex Creates a rendezvous point in the Vuser script. The difference between lr_rendezvous and lr_rendezvous_ex is that lr_rendezvous always returns zero. Example See Also Java Language int lr. The default timeout is 30 sec. rendezvous_name The name of the rendezvous. it returns null. The difference between this function and lr_rendezvous is that lr_rendezvous returns only LR_PASS or LR_FAIL.rendezvous ( String rendezvous_name ). If the call fails.

until this function is called. Furthermore. After a call to lr_stop_transaction. including the periods in between the transaction stop and resume. the "get" functions return all data since the start of the transaction. see lr_start_sub_transaction. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_resume_transaction void lr_resume_transaction (const char *transaction_name). LR_REND_NOT_FOUND 3 The rendezvous was not found. the final results when the test is analyzed will reflect the total values. If lr_resume_transaction is not called. On UNIX platforms.h file. Example See Also Visual Basic Sub lr. is not interrupted. however. LR_REND_VUSER_DISABLED 5 Vuser was disabled for the rendezvous. LR_REND_BY_USER 6 The rendezvous was released by the user. and lr_set_transaction. statistics returned by the "get" Transaction Functions reflect only the data up to that call. For more general ways of reporting partial transaction durations.Page 108 of 337 Rendezvous Return Values The return values of the lr_rendezvous function are defined in the Lrun. LR_REND_VUSER_NOT_ MEMBER 4 Vuser was not defined in the rendezvous. the "get" functions and the final results reflect only the . the function returns 0 for success and -1 for an illegal name: HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > Rendezvous Return Values Return Code Name Code Meaning LR_REND_ALL_ARRIVED 0 Vuser was released after all the designated Vusers arrived. LR_REND_DISABLED 2 The rendezvous was disabled from the Controller. Data collection.resume_transaction ( String transaction_name ) Example See Also Visual Basic Syntax This function is retained for backward compatibility. the function returns one of the values described in the table. On PC platforms. After the call to lr_resume_transaction. Page 109 of 337 lr_resume_transaction C Language Return Values Parameterization Resumes reporting transaction data within a script. The lr_resume_transaction function resumes the reporting of transaction data within the script that was suspended by lr_stop_transaction. LR_REND_TIMEOUT 1 Vuser was released after the timeout value was reached.

lr_stop_transaction and lr_resume_transaction can be used conditionally to collect information either about an entire transaction. this technique does not apply. the final results when the test is analyzed will reflect the total values. To accomplish this. Furthermore. the data in analysis will reflect both the tests where the condition for lr_resume_transaction is met. Note that you will not be able to differentiate in analysis between iterations when . After the call to lr_resume_transaction_instance. Note: When data is collected this way. see lr_start_sub_transaction. For other ways of recording durations conditionally. After a call to lr_stop_transaction_instance. transaction_name The name of the transaction. Thus. or only the beginning. including the periods in between the transaction instance stop and resume. the final results reflect the statistics only until the call to lr_stop_transaction_instance. If you need to differentiate between occurrences where the lr_resume_transaction condition is met and those where it is not in the analysis data. until this function is called.duration from the transaction start to the lr_stop_transaction call. call lr_resume_transaction only if your condition is met. Page 110 of 337 lr_resume_transaction_instance Resumes reporting transaction instance data within a script C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_resume_transaction_instance Return Values Parameterization void lr_resume_transaction_instance ( long trans_handle ). however. and the tests where it is not. is not interrupted. and lr_set_transaction. the "get" functions return all data since the start of the transaction. this technique does not apply. If lr_resume_transaction_instance is not called. or all of the transaction. The parent_handle is the value returned from the call to lr_start_transaction_instance that created the instance. statistics returned by the "get" Transaction Functions reflect only the data up to that call. Example See Also The lr_resume_transaction_instance function resumes the reporting of transaction data within the script that was suspended by lr_stop_transaction_instance. Data collection. If the section you may wish to exclude ends before the end of the transaction. lr_stop_transaction_instance and lr_resume_transaction_instance can be used to conditionally collect information about either the beginning.

ONE_HOUR. VB Script (lr. param_name The parameter in which to save the value value A numeric value Page 113 of 337 .save_double Saves a double value as a parameter.h. For example.and lr_start_timer trans_handle The transaction instance id that was returned by lr_start_transaction_instance Page 111 of 337 lr_save_datetime Assigns the current date and time to a parameter. ONE_MIN. TIME_NOW. ONE_DAY. or the date and time with the specified offset into a parameter.save_double Sub lr. It creates the parameter if it does not exist. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_save_datetime Return Values Parameterization void lr_save_datetime(const char *format. int offset. which is defined in lrun. "The current month is %b" would return The current month is JAN. lr_set_transaction. using the constants: DATE_NOW. You can use theDatetime Format Codes to build a format with any combination of strings and codes. For example. value as Double ) Example See Also Visual Basic Syntax The lr. depending on the definitions in your computer's locale.lr_stop_transaction_instance was called and iterations where it was not. such as DATE_FM. Page 112 of 337 lr. The resulting string will be truncated once it reaches MAX_DATETIME_LEN characters.save_double function saves value to parameter param_name. Example See Also The lr_save_datetime function saves the current date and time. const char *name). TIME_NOW + ONE_HOUR name The name of the parameter to store the date/time information. For more flexible ways recording transaction times conditionally.save_double (ByVal param_name as String. The format can be a format defined in an included header file.) > lr. Visual Basic and VB Script Return Values Parameterization HP LoadRunner Online Function Reference > Utility Functions: VB. format The format of the retrieved date/time information. "%d%b%y" would return 29JAN97. offset Offset from the current date and time. see lr_start_sub_transaction.

value The integer value to assign to the parameter. Page 114 of 337 lr. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_save_int Return Values Parameterization int lr_save_int ( int value. long buf_size. Example See Also The lr_save_int function converts an integer to a string and saves the string in a parameter. For example: . where n is occurrence plus 1.save_long Saves a long value as a parameter. param_name The name of the parameter. value as long ) Example See Also Visual Basic Syntax The lr. param_name The parameter in which to save the value value An integer or long integer value Page 115 of 337 lr_save_searched_string Searches for an occurrence of a string in a buffer and saves a portion of the buffer after that string to a parameter. It creates the parameter if it does not exist. const char *search_string. and finds the nth occurrence of search_string. If the parameter does not exist.save_long function saves value to parameter param_name.save_long Sub lr. const char *param_name). VB Script (lr. Example See Also The lr_save_searched_string function searches for string search_string inside string or character array buffer. Visual Basic and VB Script Return Values Parameterization HP LoadRunner Online Function Reference > Utility Functions: VB. int offset. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_save_searched_string Return Values Parameterization int lr_save_searched_string (const char *buffer. unsigned int occurrence.save_long (ByVal param_name as String. unsigned int string_len. const char *parm_name ).) > lr. Saves an integer to a parameter. it is created.lr_save_int . and has length string_len. The substring to be saved starts at offset after the end of the nth occurrence of search_string.

. t he cont ent of par amet er Fannys_br ot her i s "Wi l l " . . / / Ski p t he space af t er " abc" 4. if the search_string occurs three times. ByVal param_value as String ) as Integer Example See Also Visual Basic Syntax The lr_save_string function assigns the specified null-terminated string to a parameter.save_string ( ByVal param_name as String. . The search_string cannot contain null characters. set occurrence to 1. / / Sear ch f or t hi r d occur r ence of " abc" 1. Use lr_save_searched_string only when you need to save a portion of a character array relative to a string occurrence. To determine the value of the parameter. parm_name Parameter name to be used in subsequent lr statements to refer to the saved information. This function is useful in correlating queries. but the buffer can contain null characters. param_value The value to assign to the parameter. . and you want the second occurrence. search_string The string to search for in the buffer. . use the lr_eval_string function.char cBuf f [ ] = " abc Emma Woodhouse abc El i zabet h Bennet abc Wi l l i am Pr i ce" . C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_save_string Return Values Parameterization int lr_save_string (const char *param_value. / / . Example See Also Java Syntax Visual Basic function lr. Example See Also Java Language int lr. Use the lr_save_string function to save strings from character arrays. Af t er t he cal l . buf_size The buffer size. 2. For example. buffer The STRING or CARRAY buffer. st r l en( cBuf f ) .save_string ( String param_value . String param_name). part of whose contents you want to save. offset The number of characters to skip after the end of the search string occurrence. l r _s ave_s ear c hed_s t r i ng( cBuf f . const char *param_name). Page 116 of 337 lr_save_string Saves a null-terminated string to a parameter. occurrence The occurrence number of the search_string (0-based count). / / Put t he next f our char act er s. " Fannys_br ot her " ) . " abc" . string_len The number of characters to save. i n par amet er Fannys_br ot her . Name is enclosed in double-quotes.

Message levels are generally set in the script's Run-time Settings dialog box. you determine which information is sent. for the script execution. param_value The value to assign to a parameter. Example See Also Java Language int lr. const char *param_name). Page 118 of 337 lr_set_debug_message Sets the message level for the script execution. message_lvl. Example See Also The lr_save_var function assigns the specified variable length string to a parameter. Page 117 of 337 lr_save_var C Language Saves a variable length string to a parameter. This function is useful in correlating queries.set_debug_message ( int message_level. unsigned int on_off). Example See Also Java Syntax Visual Basic function lr. unsigned long const options. use the lr_eval_string function. unsigned long const value_len. For example. and disabled with LR_SWITCH_OFF. The setting is enabled by passing LR_SWITCH_ON as on_off .param_name The name of the parameter. value_len The length of the value in bytes. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_save_var Return Values Parameterization int lr_save_var (const char *param_value.set_debug_message ( ByVal message_level as Integer. param_name The name of the parameter. To determine the value of the parameter. if the script's current message level in . The value can be changed from the current Run-time Settings value. options A parameter option. By setting a message level. ByVal on_off as Integer ) as Integer Example See Also Visual Basic Syntax The lr_set_debug_message function sets the debug message level. int on_off ). The messages are sent to the Application Management agent log or the LoadRunner Vuser output. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_set_debug_message Return Values Parameterization int lr_set_debug_message (unsigned int message_level. currently 0.

SWI TCH_ON) . Example See Also Java Syntax Visual Basic Function lr. message_level One of the Message Log Run-Time Settings. double duration. Example See Also Java Language int lr. double duration. and status in a single call. MSG_CLASS_EXTENDED_LOG. or subsettings.the Run-time Settings is set at "Brief" mode. Use it where the business process you want to capture in a transaction does not consist of sequential steps. return to the disabled state by setting the debug level to zero (0) and activating the option using the lr.SWITCH_ON switch as the second parameter. or where you may or may not want to create a transaction. the value can be increased to "Extended log" (LR_MSG_CLASS_EXTENDED_LOG): l r _set _debug_message( LR_MSG_CLASS_EXTENDED_LOG. depending on conditions that are known . and Full Trace. set the message level to another level. int status) as integer Example See Also Visual Basic Syntax The lr_set_transaction function creates a transaction. LR_SWI TCH_ON) and later decreased to "Brief" once again: l r _set _debug_message( LR_MSG_CLASS_EXTENDED_LOG. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_set_transaction Return Values Parameterization int lr_set_transaction(const char *name. Using LR_SWITCH_DEFAULT as on_off sets the on/off status of message_level to the default value regardless of previous calls to lr_set_debug_message. double duration. its duration. of the Extended log setting. Use LR_SWITCH_DEFAULT with a single message_level argument. int status). LR_SWI TCH_OFF) To enable logging that is disabled in the Run-time Settings. Page 119 of 337 Page 120 of 337 lr_set_transaction C Language Creates a completed transaction. To set one of these sub-settings you can use logical Or's in your message_level argument. The message levels Result Data. on_off A switch to activate or deactivate a specific message level setting. Parameter Substitution. int status). set _debug_message ( l r . are specific details. For example: l r .set_transaction( String name.set_transaction( String name. Use one of the On-Off Constants. After enabling the logging. It does not work with ORed message_level settings. l r .

lr_set_transaction creates and closes the transaction. Sum the durations and create the transaction with lr_set_transaction. Example See Also The lr_set_transaction_instance_status function sets the status of the open transaction with the transaction handle trans_handle. use the native language time functions. lr_set_transaction_instance_status changes this default value to status. By default.only during the test.) in a transaction name. In analysis. If this status is LR_AUTO the value is automatically assigned. or stop. . This transaction's lr_end_transaction_instance statement must use automatic status assignment by passing a Transaction Status of auto as its status parameter. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_set_transaction_instance_status Return Values Parameterization int lr_set_transaction_instance_status (int status. A transaction's status is defined in the status parameter of lr_end_transaction_instance. capture the duration of each series of steps that participate in the business process. long trans_handle). To create a transaction for non-sequential steps. For other languages. Page 121 of 337 lr_set_transaction_instance_status Sets the status of a transaction instance. Name A name for the transaction. lr_set_transaction can also be used to report the duration of a failed transaction by saving the duration before the transaction fails with lr_get_transaction_duration then using lr_set_transaction to create a new transaction for reporting that time. fail. Therefore. see lr_start_transaction_instance. status The transaction completion status. The auto status is not applicable. this value is LR_PASS signifying a successful transaction. no functions that work only on open transactions are applicable. The handle was returned by lr_start_transaction_instance . duration Transaction duration in seconds. One of theTransaction Status constants for pass. The period character delimits transactions and sub-transactions. use lr_start_timer and lr_end_timer. a transaction name with a period will be interpreted as two transactions. Note: Do not use the period character (. For more information on transaction instances. To capture durations in C language scripts.

Example See Also Java Syntax The lr_set_transaction_status function sets the status of those transactions currently open which have LR_AUTO in their lr_end_transaction statement. the value is automatically assigned. The auto status is not applicable. fail. or stop.status One of theTransaction Status constants for pass. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_set_transaction_status int lr_set_transaction_status (int status). status One of theTransaction Status constants for pass. lr_set_transaction_status changes this default value to status. By default. The auto status is not applicable. trans_handle The handle to a transaction instance Page 122 of 337 lr_set_transaction_status C Language Return Values Parameterization Sets the default end status of open transactions. If this status is LR_AUTO. fail. or stop.set_transaction_status ( int status). or stop. signifying a successful transaction. status One of theTransaction Status constants for pass. This transaction's lr_end_transaction statement must use automatic status assignment by passing LR_AUTO as its status parameter. signifying a successful transaction. Example See Also Java Language int lr. lr_set_transaction_status_by_name changes this default value to status. const char *trans_name). The auto status is not applicable. the value is automatically assigned. If this status is LR_AUTO. trans_name The transaction name . A transaction's status is defined in the status parameter of lr_end_transaction. Page 123 of 337 lr_set_transaction_status_by_name Sets the default end status of a single transaction. this value is LR_PASS. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_set_transaction_status_by_name Return Values Parameterization int lr_set_transaction_status_by_name (int status. this value is LR_PASS. fail. By default. Example See Also The lr_set_transaction_status_by_name function sets the default status of the open transaction with name trans_name. A transaction's status is defined in the status parameter of lr_end_transaction.

a sub-transaction "electrical_purchases" may be nested within the larger transaction "purchases. For example.Page 124 of 337 lr_start_sub_transaction Starts a sub-transaction specified by its parent's name. sub_transaction The name of the sub-transaction parent_transaction The name of the parent transaction in which the sub-transaction is nested. use lr_end_sub_transaction. Sub-transactions are used for isolating parts of a business process. a transaction name with a period will be interpreted as two transactions. Each lr_start_sub_transaction statement must be matched with an lr_end_sub_transaction statement within the script or it will be interpreted as an illegal command. The period character delimits transactions and sub-transactions. Page 125 of 337 lr_start_timer . In analysis. Example See Also Java Language int lr. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_start_sub_transaction Return Values Parameterization int lr_start_sub_transaction (const char *sub_transaction. Multiple sub-transactions can be nested within a parent transaction. You insert these functions immediately before and after the sub-transaction actions. const char *parent_transaction). To mark the end of the sub-transaction. including the steps that are included in sub-transactions. Example See Also Java Syntax Visual Basic Function lr.) in a transaction or sub-transaction name. String parent_transaction) as Integer Example See Also Visual Basic Syntax The lr_start_sub_transaction function marks the beginning of a sub-transaction." The transaction "purchases" is the parent transaction and "electrical_purchases" the sub-transaction.start_sub_transaction (String sub_transaction. A subtransaction may also be a parent to a smaller sub–transaction. Note: Do not use the period character (. String parent_transaction). The duration of a transaction or sub-transaction is the sum of the durations of all steps between its start and end.start_sub_transaction (String sub_transaction.

transaction_name The name of the transaction. Example See Also lr_start_timer starts a timer that calculates the passage of time in seconds. In analysis. Page 126 of 337 lr_start_transaction Marks the beginning of a transaction. These functions are inserted immediately before and after the transaction. The resolution depends on the run-time environment. use the lr_start_transaction and lr_end_transaction functions. The maximum resolution is a microsecond. To indicate a transaction to be analyzed. Page 127 of 337 lr_start_transaction_instance Starts a transaction instance. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_start_transaction Return Values Parameterization int lr_start_transaction ( const char *transaction_name ).) in a transaction or sub-transaction name. Pass the handle to lr_end_timer to stop the timer.Starts a timer. Transactions can be nested. Example See Also Java Language int lr. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_start_timer Return Values Parameterization merc_timer_handle_t lr_start_timer ().start_transaction ( String transaction_name ).start_transaction ( ByVal transaction_name as String ) as Integer Example See Also Visual Basic Syntax The lr_start_transaction function marks the beginning of a transaction. Example See Also Java Syntax Visual Basic function lr. The period character delimits transactions and sub-transactions. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_start_transaction_instance Return Values Parameterization . but each lr_start_transaction statement must be associated with an lr_end_transaction statement or it will be interpreted as an illegal command. Note: Do not use the period character (. a transaction name with a period will be interpreted as two transactions. lr_start_timer returns a handle to the timer.

In analysis. Pass zero as the handle if there is no parent.) in a transaction or sub-transaction name. long handle).stop_transaction ( String transaction_name ) as Double Example See Also Visual Basic Syntax This function is retained for backward compatibility. until lr_resume_transaction is called. The function returns the handle of the transaction instance which identifies the instance. a transaction name with a period will be interpreted as two transactions. This function enables multiple instances of a transaction to be created. Page 128 of 337 lr_stop_transaction C Language Return Values Parameterization Freezes reporting of transaction data. The specified transaction must have . Note: Do not use the period character (. After a call to lr_stop_transaction. For more information on sub-transactions. and lr_set_transaction.long lr_start_transaction_instance ( const char *transaction_name. handle The parent transaction's handle. Example See Also The lr_start_transaction_instance function marks the beginning of a transaction instance. see lr_start_sub_transaction. For more general ways of reporting partial transaction durations. the new instance will be considered a subtransaction instance of the parent. Note that each lr_start_transaction_instance statement must be matched with an lr_end_transaction_instance statement or it will be interpreted as an illegal command. see lr_start_sub_transaction. transaction_name The name of the transaction. Instances are identified by their handle which distinguishes them from other instances of the same transaction. A transaction instance is an occurrence of a transaction with transaction_name. statistics returned by the "get" Transaction Functions reflect only the data up to the call. Example See Also Visual Basic Function lr. A value of 0 instructs VuGen to create a new parent transaction. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_stop_transaction double lr_stop_transaction (const char *transaction_name). By passing the handle of a parent transaction instance. The period character delimits transactions and sub-transactions. Use transaction instances when the same transaction is required to be performed under different circumstances and an analysis of each circumstance is required.

is not interrupted. After the call to lr_resume_transaction. however. the final results when the test is analyzed will reflect the total values. including the periods in between the transaction stop and resume. Data collection. To accomplish this. Data collection. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_stop_transaction_instance double lr_stop_transaction_instance (long parent_handle). Example See Also After a call to lr_stop_transaction_instance. or only the beginning. Thus. the data in analysis will reflect both the tests where the condition for lr_resume_transaction is met. transaction_name The name of an open transaction. Note: When data is collected this way. If lr_resume_transaction is not called. the "get" functions return all data since the start of the transaction. . the final results when the test is analyzed will reflect the total values.been opened with lr_start_transaction. this technique does not apply. the "get" functions and the final results reflect only the duration from the transaction start to the lr_stop_transaction call. If the section you may wish to exclude ends before the end of the transaction. including the periods in between the transaction stop and resume. the "get" functions return all data since the start of the transaction instance. Furthermore. statistics returned by the "get" Transaction Functions reflect only the data up to the call. is not interrupted. the final results reflect the statistics only until the call to lr_stop_transaction_instance. The specified transaction instance must have been opened with lr_start_transaction_instance. until lr_resume_transaction_instance is called. call lr_resume_transaction only if your condition is met. After the call to lr_resume_transaction_instance. If you need to differentiate between occurrences where the lr_resume_transaction condition is met and those where it is not in the analysis data. and the tests where it is not. this technique does not apply. however. lr_stop_transaction and lr_resume_transaction can be used conditionally to collect information either about an entire transaction. If lr_resume_transaction_instance is not called. Furthermore. Page 129 of 337 lr_stop_transaction_instance C Language Return Values Parameterization Freezes reporting statistics for a transaction instance specified by its handle.

Page 130 of 337 lr_think_time C Language Pauses execution between commands in a script. Example See Also Java Syntax Visual Basic function lr. thinkTime The length of the pause. lr_stop_transaction_instance returns the duration of the instance in seconds. parent_handle A unique transaction handle.think_time ( ByVal thinkTime as Double ) Example See Also Visual Basic Syntax lr_think_time allows you to pause test execution during a run. This is especially useful in simulating think time. Page 131 of 337 lr_user_data_point Records a user-defined data sample.think_time ( double thinkTime ). 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. Example See Also Java Syntax Visual Basic sub lr. see lr_start_sub_transaction. double value ).The parent_handle is the value returned from the call to lr_start_transaction_instance that created the instance. Example See Also Java Language int lr. Example See Also Java Language void lr.user_data_point ( ByVal sample_name as String. lr_stop_transaction_instance and lr_resume_transaction_instance can be used to conditionally collect information about either the beginning. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_think_time Return Values Parameterization void lr_think_time (double thinkTime). For more flexible ways recording transaction times conditionally.user_data_point ( String sample_name. the time a real user pauses to think between actions. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_user_data_point Return Values Parameterization int lr_user_data_point (const char *sample_name. in seconds. ByVal value as double ) as Integer . or all of the transaction.and lr_start_timer. double value). lr_set_transaction.

However. the output is output. Example See Also The lr_user_data_point_ex function is the same as lr_user_data_point except for the additional parameter log_flag. The time that the sample is recorded automatically. value The value to record.Example See Also Visual Basic Syntax The lr_user_data_point function allows you to record your own data for analysis. lr_user_data_point_ex enables you to write a data point to the Vuser log file. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_user_data_point_ex Return Values Parameterization int lr_user_data_point_ex ( const char *sample_name. Each time you want to record a point. will not appear on the graph. therefore "http_BT" is a valid sample_name. Logging means writing data to a file. If log_flag is DP_FLAGS_STANDARD_LOG then it will be logged . Note: The following prefixes in sample_name are reserved: HTTP NON_HTTP RETRY mic_ stream_ mms_ A data point with any of these prefixes. the prefixes are case-sensitive. It can either be part of a Standard level when only the most important information is logged or an Extended level. When run in VuGen. use this function to record the sample name and the value. double value. 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 currently activate. when fuller logging is required. sample_name The data point name.txt You may want to write the data point conditionally according to how important the data to be logged is. After the execution. 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 execution. for example "HTTP_BT". int log_flag). you can use the User Defined Data Points graph to analyze the results. Page 132 of 337 lr_user_data_point_ex Records a user-defined data sample and enables logging option.

parent_handle A transaction instance identifier with which to associate the data_point. double value. Logging means writing data to a file. double value. Example See Also The lr_user_data_point_instance function is similar to lr_user_data_point except for its transaction_handle parameter which allows you to associate a data point with a specific transaction instance.txt . HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_user_data_point_instance_ex long lr_user_data_point_instance_ex (const char* sample_name. long transaction_handle. long transaction_handle). value The value to record. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_user_data_point_instance long lr_user_data_point_instance (const char *sample_name. lr_user_data_point_instance_ex enables you to write a data point to the Vuser log file. sample_name A string indicating the name of the sample type. DP_FLAGS_NO_LOG indicates that this data point is never written to a log file.only if the Standard setting is active. sample_name A string indicating the name of the sample type. For details on transaction instances. When run in VuGen. the output is output. see lr_start_transaction_instance. Example See Also The lr_user_data_point_instance_ex function is the same as lr_user_data_point_instance except for the additional parameter log_flag. int log_flag). This function is intended for use with applications integrated with LoadRunner that use transaction instances. Page 134 of 337 lr_user_data_point_instance_ex C Language Return Values Parameterization Records a user-defined data sample and correlates it to a transaction instance. log_flag Determines whether the data point should be logged or not: DP_FLAGS_NO_LOG (1) DP_FLAGS_STANDARD_LOG (2) DP_FLAGS_EXTENDED_LOG (3) Page 133 of 337 lr_user_data_point_instance C Language Return Values Parameterization Records a user-defined data sample and correlates it to a transaction instance. value The value to record.

Visual Basic and VB Script Return Values Parameterization HP LoadRunner Online Function Reference > Utility Functions: VB. sample_name A string indicating the name of the sample type.You may want to write the data point conditionally according to the importance of the data to be logged.vuser_group function returns the name of the Vuser group to which the Vuser belongs. when fuller logging is required.vuser_id function returns the ID of the running Vuser. 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.) > lr. 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. VB Script (lr.vuser_group ( ) as String Example See Also Visual Basic Syntax The lr. HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_vuser_status_message . 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) Page 135 of 337 lr.) > lr. Page 137 of 337 lr_vuser_status_message C Language Return Values Parameterization Sends a message to the Vuser status area. If log_flag is DP_FLAGS_STANDARD_LOG then it will be logged only if the Standard setting is active. parent_handle A transaction instance identifier with which to associate the data_point.vuser_id Return Values Parameterization Function lr. VB Script (lr.vuser_group Function lr. Page 136 of 337 lr. DP_FLAGS_NO_LOG indicates that this data point is never written to a log file. value The value to record. Visual Basic and VB Script HP LoadRunner Online Function Reference > Utility Functions: VB. It can either be part of a Standard level when only the most important information is logged or an Extended level.vuser_group Returns the name of the Vuser group.vuser_id Returns the Vuser ID.vuser_id ( ) as Long Example See Also Visual Basic Syntax The lr.

scid A pointer to an output argument to store the Scenario or Session step ID number.int lr_vuser_status_message (const char *format). lr_wasted_time allows you to subtract the time wasted on incidental or secondary actions from all open transactions. Memory for the string is allocated automatically. It also sends this string to the Vuser log. vuser_id A pointer to an output argument to store the Vuser ID number. not altered. Example See Also Java Language int lr. When run from VuGen. C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_whoami Return Values Parameterization void lr_whoami (int *vuser_id. . Page 138 of 337 lr_wasted_time Removes wasted time from all open transactions. see Wasted Time. replace the parameter name with NULL. sgroup A pointer to an output argument to store the name of the Vuser Group.txt. the message is sent to output. Not applicable for products that do not run individual Vusers. wasteTime The time in milliseconds to be removed from all open transactions. For more information. You do not have to allocate explicitly in the script.vuser_status_message ( String message ). C Language HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_wasted_time Return Values Parameterization void lr_wasted_time (long wasteTime). Example See Also The lr_whoami function gets information about the Vuser. Example See Also Other languages See lr_set_transaction for an alternative. char **sgroup. Example See Also Java Syntax Visual Basic Function lr. If you do not want to retrieve one or more of the parameters. Page 139 of 337 lr_whoami Returns information about the Vuser executing the script. Note that the sgroup parameter is a pointer to constant data and should only be read. int *scid).vuser_status_message ( message As String ) as Integer Example See Also Visual Basic Syntax The lr_vuser_status_message function sends a string to the Status area of the Controller.

If precision is greater than fractional part. "Dent"). The possible letter codes are as follows: Note that a separate formatting specification must be provided for each expression to be printed. prints trailing zeros g. Three types of modifiers can appear between the percent sign (%) and the format code character: HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > Message Formatting Character Argument Type Printed As d.G double engineering notation without trailing zeros or trailing decimal point % none print the character `%' (justification) A hyphen (-) indicates that the printed output is to be left justified in its field. field width A number. indicates how many characters the field should be padded. Page 141 of 337 Message Log Run-Time Settings There are three main settings for run-time message logging: The following are "ORed" with the Extended Log message setting used to further refine the setting: .X int unsigned hexadecimal number without a leading 0x u int unsigned decimal number c int single character s char * print characters until either `\0' or the number of characters given in the precision is reached e. "Arthur".i int decimal number o int unsigned octal number without a leading zero x.Page 140 of 337 Message Formatting The first character of the format parameter is always a percent sign (%). One or more format modifiers can appear between the first and last character of the format argument (see below). precision A number to the right of a decimal point indicates the maximum width of the printed string or how many digits are printed to the right of the output decimal point. Without the second "%s. the padding occurs with zeros to the left of the printed value. For example. the statement: printf("My name is %s%s\n". prints the statement "My name is Arthur Dent" to standard output. The last character of format is a letter code that determines the type of formatting. When this number is preceded by a 0.E double engineering notation (m.dddddd e+exponent). The output generated by a particular formatting code can be modified. by itself or to the left of a decimal point." the second expression (Dent) would have been ignored.

MSG_CLASS_ DISABLE_LOG 0 Brief LR_MSG_CLASS_ BRIEF_LOG lr. Which messages sent on error depends on other settings.This setting can be "ORed" with all other message setting: HP LoadRunner Online Function Reference > Utility Functions: Socket ID Functions > Message Log Run-Time Settings Log Level C Language Constants Object Oriented Constants Value Disabled LR_MSG_CLASS_ DISABLE_LOG lr.MSG_CLASS_ BRIEF_LOG 1 Extended Log LR_MSG_CLASS_ EXTENDED_LOG lr.MSG_CLASS_ EXTENDED_LOG 16 Log Level C Language Constants Object Oriented Constants Value Result Data LR_MSG_CLASS_ RESULT_DATA lr. LR_MSG_CLASS_ JIT_LOG_ON_ ERROR .MSG_CLASS_ FULL_TRACE 8 Log Level C Language Constants Object Oriented Constants Value Only on error.MSG_CLASS_ RESULT_DATA 2 Parameter Substitution LR_MSG_CLASS_ PARAMETERS lr.MSG_CLASS_ PARAMETERS 4 Full Run-Time Trace LR_MSG_CLASS_ FULL_TRACE lr.

click the Parameterization button in that function. LR_SWITCH_ ON lr.SWITCH_ ON 1 Uses the defaults from the script's cfg file.MSG_CLASS_ JIT_LOG_ON_ ERROR 512 Page 142 of 337 On-Off Constants These are the constants for activating and deactivating settings: HP LoadRunner Online Function Reference > Utility Functions: Socket ID Functions > On-Off Constants Action C Language Constants Object Oriented Constants Value Turns the setting off. HP LoadRunner Online Function Reference > Utility Functions: Socket ID Functions > Parameterization Background Page 144 of 337 Raw Body Attribute Binary content can be sent in the request using the BodyBinary attribute (or the Body attribute when "Binary=1" is also specified). To enable a more simple representation of the raw data. The syntax for sending raw body content is a set of 4 arguments to web_custom_request(). LR_SWITCH_ OFF lr. However.lr.SWITCH_ OFF 0 Turns the setting on. LR_SWITCH_ DEFAULT lr. the Raw Body attribute instead enables you to pass a pointer to the binary content. They must appear in the following order: The correct order is: RAW_BODY_START.SWITCH_ DEFAULT 2 Page 143 of 337 Parameterization Background For information about the arguments that are available for parameterization. this method requires that content is converted into ASCII text using escape backslashes for non–printable text. .

.g.0 and 8. 3. That is. "{MyParam}") in the data buffer will not be substituted with the corresponding parameter value.. / * a poi nt er t o t he r aw dat a */ web_cust om_r equest ( "St epName" . "Met hod=POST" . even when the length is 0. LR_EXIT_MAIN_ ITERATION_ . Thi s was t he behavi or bef or e ver si on 8.EXIT_VUSER Exit without any condition. The pointer data buffer must not be NULL.1. "URL=ht t p: / / some. and go to the next action.EXIT_ACTION_ AND_CONTINUE Stop current action. " abc" . RAW_BODY_START. and will be used as is. 1. LAST) . RAW_BODY_END. The data buffer cannot be parameterized. any parameter reference (e. ur l " . HP LoadRunner Online Function Reference > Utility Functions: Socket ID Functions > Raw Body Attribute Page 145 of 337 Script Continuation Options Scripts exit with one of these options for continuation: Note: The behavior of LR_EXI T_MAI N_I TERATION_AND_CONTI NUE and LR_EXI T_I TERATION_AND_CONTI NUE changed between versions 8. The Raw Body group cannot be used with the Binary parameter set ("Binary=1"). ( i nt ) l engt h. and go directly to end action LR_EXIT_ACTION_ AND_CONTINUE lr. These options can be configured by using these run options: -main_iteration_exit: Both LR_EXI T_MAI N_I TERATION_AND_CONTI NUE and LR_EXI T_I TERATION_AND_CONTI NUE behave like LR_EXI T_MAI N_I TERATION_AND_CONTI NUE. . -block_iteration_exit: Both LR_EXI T_MAI N_I TERATION_AND_CONTI NUE and LR_EXI T_I TERATION_AND_CONTI NUE behave like LR_EXI T_I TERATION_AND_CONTI NUE Add these flags in the [action_logic] section in mdrv. RAW_BODY_END The syntax is illustrated in the following example: char *abc= .a poi nt er t o t he dat a buf f er .dat: ExtCmdLine=-main_iteration_exit or ExtCmdLine=-block_iteration_exit HP LoadRunner Online Function Reference > Utility Functions: Socket ID Functions > Script Continuation Options C Constants Object Oriented Constants Behavior LR_EXIT_VUSER lr.

STOP Visual Basic Syntax String Arguments Argument Lists Special Characters . If called from within a block iteration. but may change at any time until the transaction completes.FAIL LR_AUTO lr. and not the global iteration.AND_CONTINUE lr. and go to the next iteration. The status can be read before completion.PASS LR_FAIL lr. LR_EXIT_VUSER_ AFTER_ITERATION lr.EXIT_MAIN_ ITERATION_ AND_CONTINUE Stop current global script run iteration.PASS LR_FAIL lr. and go to the next iteration. LR_EXIT_VUSER_ AFTER_ACTION lr.EXIT_ITERATION_ AND_CONTINUE Stop current iteration.EXIT_VUSER_ AFTER_ACTION Run until the end of the current action and then exit.AUTO Page 147 of 337 Transaction Status Transactions complete with one of these statuses.FAIL LR_AUTO lr. LR_EXIT_ITERATION_ AND_CONTINUE lr. only the block iteration will be exited.EXIT_VUSER_ AFTER_ITERATION Run until the end of the current iteration and then exit. Page 146 of 337 Script Exit Status Scripts exit with one of these statuses: HP LoadRunner Online Function Reference > Utility Functions: Socket ID Functions > Script Exit Status C Constants Object Oriented Constants LR_PASS lr.AUTO LR_STOP lr. HP LoadRunner Online Function Reference > Utility Functions: Socket ID Functions > Transaction Status C Constants Object Oriented Constants LR_PASS lr.