lr functions

72
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.

Upload: kuchi-nagabhushanam

Post on 21-Nov-2014

108 views

Category:

Documents


8 download

TRANSCRIPT

Page 1: Lr Functions

Page 1 of 337

Command Line Parsing FunctionsClick 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 parameterlr_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 FunctionsClick 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 LoadRunnerController .lr_get_vuser_ip Returns the IP address of the current Vuser. Not applicable forproducts 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 loggingoption.lr_user_data_point_instance Records a user-defined data sample and correlates it to atransaction instance.lr_user_data_point_instance_ex Records a user-defined data sample and enables loggingoption.lr_whoami Returns information about a Vuser executing the script. Notapplicable for products that do not run Vusers.

Page 3 of 337

Message FunctionsClick 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 orApplication Management agent log file.lr_error_message Sends an error message to the LoadRunner output window orApplication 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 withlocation 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 LoadRunnerController.

Page 4 of 337

Page 2: Lr Functions

Run-Time FunctionsClick 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 parameterlr_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 FunctionsClick 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 evaluatingembedded 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 aparameter 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 aparameter arraylr_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 aportion 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 FunctionsClick 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

Page 3: Lr Functions

an error message.lr_get_trans_instance_duration Returns the duration of a transaction instance specified byits 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 byits handle.lr_get_trans_instance_wasted_time Gets the wasted time of a transaction instance by itshandle.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'shandle.lr_stop_transaction Stops the collection of transaction data.lr_stop_transaction_instance Stops collecting data for a transaction specified by itshandle.lr_wasted_time Removes wasted time from all open transactions.

Page 7 of 337

Database FunctionsThese 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 ListingClick 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 parameterdata 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.

Page 4: Lr Functions

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 expectedvalue (checkpoint).lr_db_getValue Retrieves a value from a dataset.lr_debug_message Sends a debug message to the LoadRunner output orApplication 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 orApplication 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 afterevaluating 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 sendsan error message.lr_get_attrib_double Returns the value of a double type command lineparameter.lr_get_attrib_long Returns the value of a long integer type command lineparameter.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 LoadRunnerController.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 byits handle.lr_get_trans_instance_wasted_time Gets the wasted time of a transaction instance by itshandle.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 itsname.lr_get_vuser_ip Returns the IP address of the current Vuser. Not applicablefor products that do not run Vusers.lr_load_dll Loads an external DLL.lr_log_message Sends a message to the Vuser log file.

Page 5: Lr Functions

lr_message Sends a message to the output and log file.lr_output_message Sends a message to the output and log file with locationinformation.lr_next_row Advances to the next row in the parameter data file.lr_param_increment Increments the value of a numerical parameterlr_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 locationin 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 ina parameter arraylr_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 andsaves a portion of the buffer after that string to aparameterlr_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 instancelr_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 specifiedby its handle.lr_think_time Pauses execution between commands in a script.lr_user_data_point Records a user-defined data sample.lr_user_data_point_ex Records a user-defined data sample.lr_user_data_point_instance Records a user-defined data sample and correlates it to atransaction instance.lr_user_data_point_instance_ex Records a user-defined data sample and correlates it to atransaction instance.lr_vuser_status_message Sends a message to the Vuser status area in theController.lr_wasted_time Removes wasted time from all open transactions.lr_whoami Returns information about a Vuser executing the script

Page 11 of 337

Page 6: Lr Functions

lr_abortAborts the execution of a script.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_abort

Return Values Parameterizationvoid lr_abort( );Example See AlsoJava Languagevoid lr.abort( );Example See Also Java SyntaxThe lr_abort function aborts the execution of a script . It stops the execution of the Actions section,executes the vuser_end section, and ends the execution. This function is useful when you need tomanually abort a run as a result of a specific error condition. When you end a run using this function,the status is "Stopped."

Page 50 of 337

lr_advance_paramAdvances to the next available parameter value.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_advance_param

Return Values Parameterizationint lr_advance_param ( const char *param);Example See AlsoJava Languageint lr.advance_param ( String parameter );Example See Also Java SyntaxVisual Basicfunction lr.advance_param ( ByVal parameter as string ) as integerExample See Also Visual Basic SyntaxThe lr_advance_param function causes the script to use the next available value of the parameter.If you are running multiple iterations, you can specify in the parameter properties to advanceautomatically to the next value for each iteration. Use this function within an iteration to advance tothe next value.The effect on other parameters in the same data file depends on the settings in the Vuser parameterlist dialog. See the Example.This function is not recorded—you insert it manually into your script.param The name of the parameter in quotes (no brackets).

Page 51 of 337

lr_checkpointValidates the value of a parameter against an expected value (checkpoint).C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_checkpoint

Page 7: Lr Functions

Return Values Parameterizationint lr_checkpoint("StepName=<step_name>", "ActualValue={<input_param>}","Compare=<operator>", "ExpectedValue={<checkpoint>}","StopOnValidationError=<error_code>", LAST);Example See AlsoThe lr_checkpoint function validates the value of a parameter against a checkpoint value.If the validation fails, the script aborts or continues, depending on the values of theStopOnValidationError argument and the Continue on Error? runtime setting. The Continue onError? runtime setting takes precedence over the value of StopOnValidationError.Operators are case-sensitive.This function is not recorded. It can be added manually when enhancing the script.StepName The name of the step, as it appears in the test tree. Any text can be used.ActualValue Data to compare with the ExpectedValue argument. Can be a value or aLoadRunner parameter.Compare Operator used to compare the ActualValue and ExpectedValue values:EqualsNotEqualsContainsStartsWithEndsWithExpectedValue Data to compare with the ActualValue argument. Can be a value or aLoadRunner parameter.StopOnValidationError Indication of whether all steps fail. Valid values:false: Steps do not fail.true: Steps fail.LAST This delimiter marks the end of the argument list.

Page 52 of 337

lr_continue_on_errorSpecifies an error handling method.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_continue_on_error

Return Values Parameterizationvoid lr_continue_on_error ( int value );Example See AlsoThe lr_continue_on_error function specifies how to handle errors. You can choose to continuerunning if an error occurs, or to abort the run execution.Normally, you specify how the test run component handles errors during script execution using theGeneral section in VuGen's Runtime Settings dialog. By default, the script exits when an error occurs.To continue script execution even when errors occur, select the Continue on Error check box inVuGen's Runtime Settings.However, you can control error handling for a specific segment of the script, by inserting thelr_continue_on_error function before and after the desired segment (see the example for details).

Page 8: Lr Functions

In addition to the lr_continue_on_error statements, you can use severity levels to control errorhandling for database operation errors in LoadRunner.value One of the Error Continuation Options.

Page 53 of 337

lr_convert_string_encodingConverts a string to a different encoding.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_convert_string_encoding

Return Values Parameterizationint lr_convert_string_encoding ( const char *sourceString, const char *fromEncoding,const char *toEncoding, const char *paramName);Example See Alsolr_convert_string_encoding converts a string encoding between the following encodings: Systemlocale, Unicode, and UTF-8. The function saves the result string, including its terminating NULL, in theparameter paramName.lr_convert_string_encoding is added manually to a script when needed. It is not recorded.Possi bl e val ues f or ' f r omEncodi ng' and ' t oEncodi ng' :sourceString The string to convertfromEncoding The encoding of the sourceStringtoEncoding The encoding to convert of the string saved in parameter paramNameparamName The name of the parameter in which the destination string will be savedConstant ValueLR_ENC_SYSTEM_LOCALE NULLLR_ENC_UTF8 "utf-8"LR_ENC_UNICODE "ucs-2"

Page 54 of 337

lr_db_connectConnects to a database.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_db_connect

Return Values Parameterizationint lr_db_connect("StepName", "ConnectionString=<connection_string>","ConnectionName=<connection_name>", "ConnectionType=<connection_type>",LAST);Example See AlsoThe lr_db_connection function establishs the database connection used by other database relatedfunctions, such as lr_db_executeSQLStatement .Tip: Use the Connection Dialog to create a database specific connection string. Select theDatabase: Connect option in the Add Step dialog box and enter the connection parameters.

Page 9: Lr Functions

When specifying the connection string for a specific SQL Server instance, use the server and instancename in the data source, escaping the backslashes in the path. For example:"Connect i onSt r i ng=Ser ver=soa-m16\ \ soa;Dat abase=. . .When specifying the connection string using SQL Server 2005 Express, use the server name syntax<SQL Server 2005 Express installation>\SQLEXPRESS.Add lr_db_connect to the vuser_init section of the script. Adding this function to the Action sectioncan increase performance overhead during load testing.StepName The name of the step, as it appears in the test tree. Any text can be used.ConnectionString A string indicating the database to which to connect and other informationneeded to establish the connection.The syntax for the connection string varies depending on the data providerspecified with the ConnectionType argument. For example, to connect to an SQLServer, ConnectionString could contain the value:Dat a Sour ce=mySer ver Addr ess; I ni t i al Cat al og=myDat abaseI d=myUser ; Passwor d=myPasswor d;Note that the equal signs are part of the connection string.The password cannot be encrypted.ConnectionName A logical name for the connection.ConnectionType Type of data provider. Valid values are:SQL (meaning, the Microsoft Native SQL Provider)OLEDBODBCORACLELAST This delimiter marks the end of the argument list.

Page 55 of 337

lr_db_dataset_actionPerforms an action on a dataset.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_db_dataset_action

Return Values Parameterizationint lr_db_dataset_action("StepName=<step_name>","DatasetName=<dataset_name>", "Action=<action>", LAST);Example See AlsoThe lr_db_dataset_action function sets the cursor to the first record of the dataset, removes itfrom memory, or prints the dataset to the Replay Log.When printing a dataset, only the first one hundred records are listed in the test report summaries.The total number of records is also listed.StepName The name of the step, as it appears in the test tree. Any text can be used.DatasetName Logical name for the dataset specified in lr_db_executeSQLStatement .Action The action to perform on the dataset:RESET: Set the cursor to the first record of the dataset.REMOVE: Releases the memory allocated for the dataset.PRINT: Prints the contents of the entire dataset to the Replay Log and other testreport summaries.LAST This delimiter marks the end of the argument list.

Page 56 of 337

Page 10: Lr Functions

lr_db_disconnectDisconnects from a database.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_db_disconnect

Return Values Parameterizationint lr_db_disconnect("StepName=<step_name>","ConnectionName=<connection_name>", LAST);Example See AlsoThe lr_db_disconnect function disconnects a database connection.You must call lr_db_disconnect for each connection established by lr_db_connect to terminate theconnection.Add lr_db_disconnect to the vuser_end section of the script. Adding this function to the Actionsection can increase performance overhead during load testing.StepName The name of the step, as it appears in the test tree. Any text can be used.ConnectionName The logical name for the connection specified in lr_db_connect .LAST This delimiter marks the end of the argument list.

Page 57 of 337

lr_db_executeSQLStatementSubmits an SQL statement to a database.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_db_executeSQLStatement

Return Values Parameterizationint lr_db_executeSQLStatement("StepName=<step_name>","ConnectionName=<connection_name>", "SQLStatement=<statement>",["DatasetName=<dataset_name>",] LAST);Example See AlsoThe lr_db_executeSQLStatement submits an SQL statement to a database.When SQLStatement is a SELECT statement, DatasetName points to the resulting dataset. In thiscontext, the term dataset is used to describe tables of data (formatted as rows and columns). Thedata in the dataset can be manipulated by subsequent steps in the script.When SQLStatement is either DELETE, INSERT, or UPDATE, a warning is issued to the Replay Log andthe test results summary.After calling this function, the row is undefined. In this case, make sure to set Row to next or 1 ifcalling lr_db_getValue after this function.StepName The name of the step, as it appears in the test tree. Any text can be used.ConnectionName The logical name for the connection specified in lr_db_connect .SQLStatement The SQL statement, such as SELECT, INSERT, DELETE, and UPDATE. The syntaxis database-dependent. SQLStatement can be parameterized.DatasetName Logical name for the resulting dataset from the SQL query, by which you can referto the dataset in subsequent steps. For use only when SQLStatement is a SELECTstatement.LAST This delimiter marks the end of the argument list.

Page 11: Lr Functions

Page 58 of 337

lr_db_getValueRetrieves a value from a dataset.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_db_getValue

Return Values Parameterizationint lr_db_getValue("StepName=<step_name>", "DatasetName=<dataset_name>","Column=<column>", "Row=<row>", "OutParam=<output_parm>", LAST);Example See AlsoThe lr_db_getValue function retrieves a value from the dataset created by anlr_db_executeSQLStatement.When this function reaches the last row of the dataset, the row is undefined. If Row=next isspecified the next time lr_db_getValue is called, the script continues to the first record withoutissuing any errors.This function does not support the print or output of binary data. Binary values retrieved from thedataset appear as <binary_data>.StepName The name of the step, as it appears in the test tree. Any text can be used.DatasetName Logical name for the dataset specified in lr_db_executeSQLStatement .Column The name of the column in the dataset from which to retrieve the value.Row Sets the dataset cursor to the specifed row before fetching data. One of:The row number (1-based)current - does not move the cursornext - sets the cursor to the next rowOutParam The LoadRunner parameter that will contain the value.LAST This delimiter marks the end of the argument list.

Page 59 of 337

lr_debug_messageSends a debug message to the log file.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_debug_message

Return Values Parameterizationint lr_debug_message (unsigned int message_level, const char *format, ... );Example See AlsoJava Languageint lr.debug_message ( int message_level, String message );Example See Also Java SyntaxVisual Basicfunction lr.debug_message ( ByVal message_level as Integer, ByVal message as string )as IntegerExample See Also Visual Basic SyntaxThe lr_debug_message function sends a debug message when the specified message level is active.

Page 12: Lr Functions

If the specified message level is not active, a message is not issued. You can set the active messagelevel to MSG_CLASS_BRIEF_LOG or MSG_CLASS_EXTENDED_LOG from the user interface or by usinglr_set_debug_message. To determine the current level, use lr_get_debug_message.Note that you can also specify multiple message levels with an OR separator ("|"). If any one of thelevels are active (from the UI), the message is issued to the Output window. If none of the levels areactive, the message is not issued.The message is sent to the output window. To display the debug messages in the LoadRunner outputwindow or Application Management agent log file, use the Expert Mode Settings. Activate Expert Mode(Tools > Expert Mode) and then choose Tools > Options > Debug Information and select theGeneral check box.message_level One of the Message Log Run-Time Settings. Disabled does not apply.format A formatted string which is the message to be sent to the log file. You may use thestandard Message Formatting that is available for printf.

Page 60 of 337

lr_decryptDecrypts an encoded stringC LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_decrypt

Return Values Parameterizationchar *lr_decrypt (const char *EncodedString);Example See AlsoJava LanguageString lr.decrypt ( String EncodedString );Example See Also Java SyntaxVisual Basicfunction lr.decrypt ( ByVal EncodedString as String ) as StringExample See Also Visual Basic SyntaxThe lr_decrypt function decrypts an encoded string. This function is generated during recording toencode passwords. VuGen records the actual password but displays an encoded version of thepassword within the lr_decrypt function.When you run the script, the test run component decrypts the password. Each time you record,VuGen encrypts the password differently, even when you use the same password.It is possible to create an lr_decrypt call from a recorded value in the script. Select an entire stringbetween quote marks, not including the quote marks themselves. Right-click in the selected string andchoose the ENCRYPT STRING option. The original string is replaced with an lr_decrypt call where theEncodedString argument is the original string after encoding.To get an encryped value from a recorded value for later use, copy the recorded value. Then run

Page 13: Lr Functions

Start > Programs > LoadRunner > Tools > Password Encoder. Paste the value into the Passwordfield, and click Generate. The encrypted string appears in the Encoded string box. Click the Copybutton, then paste the encryped string into a parameter for later use, or assign the value to a stringvariable.VuGen uses 32 bit encryption.EncodedString The encoded string you want to decrypt.

Page 61 of 337

lr_disable_ip_spoofingDisables IP SpoofingC LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_disable_ip_spoofing

Return Values Parameterizationint lr_disable_ip_spoofing ( );Example See Alsolr_disable_ip_spoofing disables IP spoofing during a script run.

Page 62 of 337

lr.emptyReturns an Variant whose value is Empty.Java ScriptHP LoadRunner Online Function Reference > Utility Functions: Java Language (lr.) > lr.empty

Return Values ParameterizationVariant lr.empty ();Example See AlsoVB ScriptFunction lr.empty () as Variant;Example See AlsoUse lr.empty to pass an Empty variant to a function that requires a Variant argument.In Visual Basic, VB.NET or C#, use the class or keyword Empty.

Page 63 of 337

lr_enable_ip_spoofingEnables IP SpoofingC LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_enable_ip_spoofing

Return Values Parameterizationint lr_enable_ip_spoofing ( );Example See Alsolr_enable_ip_spoofing enables IP spoofing during a script run.

Page 64 of 337

lr_end_sub_transactionMarks the end of a sub-transaction.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_end_sub_transaction

Return Values Parameterization

Page 14: Lr Functions

int lr_end_sub_transaction (const char *sub_transaction, int status );Example See AlsoJava Languageint lr.end_sub_transaction ( String sub_transaction, int status );Example See Also Java SyntaxVisual Basicfunction lr.end_sub_transaction ( sub_transaction as String, status as Integer ) asIntegerExample See Also Visual Basic SyntaxThe lr_end_sub_transaction function marks the end of a sub-transaction. To mark the beginning ofthe sub-transaction, use the lr_start_sub_transaction function. You insert these functions immediatelybefore and after the sub-transaction steps.Multiple sub-transactions can be nested within a parent transaction, but eachlr_end_sub_transaction statement must match an lr_start_sub_transaction statement or it will beinterpreted as an illegal command.sub_transaction A string indicating the name of an existing sub-transaction.status The transaction status.

Page 65 of 337

lr_end_timerStops a timer.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_end_timer

Example Return Values Parameterization See Alsodouble lr_end_timer (merc_timer_handle_t timer);Example See_Alsolr_end_timer stops a timer that began timing when lr_start_timer was called. It returns the elapsedtime in seconds. The resolution depends on the run-time environment. The maximum resolution is amicrosecond.timer The handle of the timer returned by lr_start_timer.

Page 66 of 337

lr_end_transactionMarks the end of a transaction.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_end_transaction

Return Values Parameterizationint lr_end_transaction (const char *transaction_name, int status ) ;Example See AlsoJava Languageint lr.end_transaction ( String transaction_name, int status );Example See Also Java SyntaxVisual Basic

Page 15: Lr Functions

function lr.end_transaction ( ByVal transaction_name as string, ByVal status as Integer )as IntegerExample See Also Visual Basic SyntaxThe lr_end_transaction function marks the end of a transaction and records the amount of time ittook to perform the transaction. To indicate a transaction to be analyzed, place thelr_start_transaction function before the transaction, and the lr_end_transaction function after thetransaction.You can manually set the status of the transaction or you can allow the script to detect itautomatically. To manually set the status, you perform a manual check within the code of your script(see example) evaluating the return code of a function. For the "succeed" return code, set the statusto LR_PASS. For a "fail" return code, set the status to LR_FAIL. For an "aborted" return code, set thestatus to LR_STOP.If status is LR_AUTO, then the value of status is automatically assigned. By default, this value isLR_PASS signifying a successful transaction. However, if prior to lr_end_transaction, you change thedefault value using lr_set_transaction_status, lr_set_transaction_status_by_name,lr_set_transaction_instance_status or lr_fail_trans_with_error, then this is the value which ispassed as status in lr_end_transaction.If you make a series of calls to functions that modify the LR_AUTO status, then it is the last callbefore lr_end_transaction which effectively changes the status.transaction_name A string indicating the name of an existing transaction.status The Transaction Status

Page 67 of 337

lr_end_transaction_instanceMarks the end of a transaction instance.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_end_transaction_instance

Return Values Parameterizationint lr_end_transaction_instance (long parent_handle, int status );Example See AlsoThe lr_end_transaction_instance function marks the end of a transaction instance and records theamount of time it took to perform the transaction. To indicate a transaction instance to be analyzed,place the lr_start_transaction_instance function before the transaction, and thelr_end_transaction_instance function after the transaction.You can manually set the status of the transaction instance or you can allow the script to detect itautomatically. To manually set the status, you perform a manual check within the code of your script

Page 16: Lr Functions

(see example) evaluating the return code of a function. For the "succeed" return code, set thetransaction status to LR_PASS. For a "fail" return code, set the status to LR_FAIL. For an "aborted"return code, set the status to LR_STOP.To instruct the script to automatically detect the status, specify LR_AUTO. The script returns thedetected.parent_handle The handle returned by lr_start_transaction_instance at the creation of theinstance.status The transaction status.

Page 68 of 337

lr_error_messageSends an error message with location details to the output windows, log files, and other test reportsummaries.int lr_error_message (const char *format, exp1, exp2,...expn. );HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_error_message

Return Values ParameterizationExample See AlsoJava Languageint lr.error_message ( String message );Example See Also Java SyntaxVisual Basicfunction lr.error_message ( ByVal message as String ) as IntegerExample See Also Visual Basic SyntaxThe lr_error_message function sends an error message to product output windows (such as theLoadRunner output window), log files (such as Vugen and the Application Management agent log file),and other test report summaries. For details regarding the output for each product, see the products'user guides.To send a special notification that is not specifically an error message, use lr_output_message.If Run-time settings > General > Miscellaneous > Fail open transactions on lr_error_messageis selected, calling lr_error_message will fail the transaction in addition to sending the message. Ifyou want to save the elapsed time in spite of the transaction failure, capture the time withlr_get_transaction_duration before calling lr_error_message, then create a transaction to report thetime with lr_set_transaction.It is not recommended that you send a message to the Output window in the middle of a transaction,as it will lengthen the execution time. Instead, use lr_log_message to send the message only to theVuser log file. This conserves the resources required for sending messages to theVuGen displays the message text of the lr_error_message function in the Execution log in red, using

Page 17: Lr Functions

Error code 17999. Note that this function sends a message to the output even when logging isdisabled in the run-time settings.In the Vuser Execution log, this function lists the location and line number from where the messagewas issued. To issue a message without those details, use lr_message.Out put of l r _er r or _message( " out put message" ) ; - Act i on( 4) : out putmessageOut put of l r _message( "message" ) ; -messageformatC LanguageA formatted string to send to the Output window. You may specify a literal string inquotation marks or use the standard Message Formatting that is available for printf.exp1, exp2,..expnC LanguageThe expressions or variables to be formatted.messageJava andVisual BasicA string containing the error message to send to the Output window. See VB StringArguments and Java String Arguments.Page 69 of 337

Page 70 of 337

lr.eval_doubleReturns the double value of the parameter.Visual Basic and VB ScriptHP LoadRunner Online Function Reference > Utility Functions: VB, VB Script (lr.) > lr.eval_double

Return Values Parameterizationfunction lr.eval_double (ByVal param_name as String ) as DoubleExample See Also Visual Basic SyntaxThe lr.eval_double function returns the value of the parameter as a doubleparam_name The parameter to evaluate.

Page 71 of 337

lr.eval_longReturns the long value of the parameter.Visual Basic and VB ScriptHP LoadRunner Online Function Reference > Utility Functions: VB, VB Script (lr.) > lr.eval_long

Return Values Parameterizationfunction lr.eval_long (ByVal param_name as String ) as longExample See Also Visual Basic SyntaxThe lr.eval_long function returns the value of the parameter as a Long.param_name The parameter to evaluate.

Page 18: Lr Functions

Page 72 of 337

lr_eval_stringReturns the string argument after evaluating embedded parameters.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_eval_string

Return Values Parameterizationchar *lr_eval_string (const char *instring );Example See AlsoJava LanguageString lr.eval_string ( String instring );Example See Also Java SyntaxVisual Basicfunction lr.eval_string (ByVal instring as String ) as StringExample See Also Visual Basic SyntaxThe lr_eval_string function returns the input string after evaluating any embedded parameters. If thestring argument contains only a parameter, the function returns the current value of the parameter.Embedded parameters must be in brackets.Note: lr_eval_string allocates memory internally. The memory is freed at the end of each iteration. Ifyou evaluate a parameter or parameters in a loop, conserve memory by not using lr_eval_string .Instead, use lr_eval_string_ext and free the memory in each loop iteration withlr_eval_string_ext_free.instring The string to evaluate.

Page 73 of 337

lr_eval_string_extCreates a buffer and assigns it the input string after evaluating embedded parameters.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_eval_string_ext

Return Values Parameterizationint lr_eval_string_ext (const char *in_string, unsigned long const in_len, char ** constout_str, unsigned long * const out_len, unsigned long const options, const char *file,long const line );Example See AlsoThe lr_eval_string_ext function evaluates in_str by replacing parameters with their string value. Itcreates a buffer containing the expanded string and sets out_str to point to that buffer. It alsoassigns the length of the buffer to out_len.Note that in_len is the length of the argument you pass, and not the length of the value of theparameter. For example, if parameter ABC contains the string "1234567890", the call is:l r _eval _s t r i ng_ext ( "{ABC}" , 5After using lr_eval_string_ext, free the memory allocated for the output buffer with

Page 19: Lr Functions

lr_eval_string_ext_free.This function is useful when correlating statements that use binary data, for example, data withembedded NULL characters.Use this function in conjunction with lr_eval_string_ext_free in preference to lr_eval_string whenevaluating strings in a loop. Using lr_eval_string in a loop uses more memory.in_str The string to be evaluated.in_len The length of the name of argument in_str +2 to account for the parentheses.out_str A pointer to the output buffer.out_len The length of the output buffer.options Reserved for future use. Currently set to "0".file Reserved for future use. Currently set to "0".line Reserved for future use. Currently set to "-1".

Page 74 of 337

lr_eval_string_ext_freeFrees the buffer allocated by lr_eval_string_ext.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_eval_string_ext_free

Return Values Parameterizationvoid lr_eval_string_ext_free (const char **param);Example See AlsoThe lr_eval_string_ext_free function frees the memory allocated by lr_eval_string_ext .param A pointer to the buffer.

Page 75 of 337

lr_exitExits from the script, action, or iteration.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_exit

Return Values Parameterizationvoid lr_exit (int continuation_option, int exit_status);Example See AlsoJava Languagevoid lr.exit (int continuation_option, int exit_status);Example See Also Java SyntaxThe lr_exit function allows you to exit from the script run during execution.A transaction in which lr_exit is called does not appear in the LoadRunner controller in theTransaction Status box. It is ignored in the count of passed and failed transactions.If lr_exit is called several times in the same script, whether in different actions or different iterations,it is the exit status of the last call that determines the status of the Vuser group running the script.The controller's Scenario Groups Status box displays the status. It is the column in which the groupappears after the run stops.continuation_option The continuation option specifies how the script continues after the call tolr_exit

Page 20: Lr Functions

exit_status The status of the scenario group as a result of calling lr_exit

Page 76 of 337

lr_fail_trans_with_errorSets the default status of open transactions to LR_FAIL and sends an error message.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_fail_trans_with_error

Example Return Values Parameterization See Alsoint lr_fail_trans_with_error (const char *format, exp1, exp2,...expn.);The lr_fail_trans_with_error function sets the default exit status to LR_FAIL for all opentransactions with LR_AUTO in their lr_end_transaction statement and sends an error message.The message is sent to the LoadRunner output window or Application Management agent log file.A transaction's final status is defined in the status parameter of the lr_end_transaction statement. Ifthis status is LR_AUTO, then the value is automatically assigned. By default the value assigned isLR_PASS, which signifies a successful transaction. lr_fail_trans_with_error changes this defaultvalue to LR_FAIL.Use the format and exp parameters in the same way as the standard Message Formatting that isavailable for printf. If it is a literal string, enclose it with quotation marks.format A string describing the format to use to write the optional remaining expressions exp1,exp2,.. expn. You may specify a literal string in quotation marks or use the standardMessage Formatting that is available for printf.exp1,exp2,..expnThe optional expressions (variables) to be formatted and printed.

Page 77 of 337

lr_get_attrib_doubleReturns a value of the calling mdrv command's parameter as a double.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_attrib_double

Return Values Parameterizationdouble lr_get_attrib_double (const char *parameter);Example See Also

Page 21: Lr Functions

Java Languagedouble lr.get_attrib_double ( String parameter );Example See AlsoVisual Basicfunction lr.get_attrib_double ( ByVal parameter as String ) as doubleExample See Also Visual Basic SyntaxThe lr_get_attrib_double function returns the value of a command line parameter whose type is adouble precision floating point when the script is run using the mdrv command. You place thecommand line parameter's name in the function's argument field and lr_get_attrib_double returns thevalue of that parameter.The function returns NULL if the mdrv command line was not used to run the script (for example, thescript was run directly in VuGen or by LoadRunner). For more information on the running scripts usingthe mdrv command line, see the HP LoadRunner Virtual User Generator User Guide.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.

Page 78 of 337

lr_get_attrib_longReturns a value of the calling mdrv command's parameter as a long integer.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_attrib_long

Return Values Parameterizationlong lr_get_attrib_long (const char *parameter);Example See AlsoJava Languagelong lr.get_attrib_long ( String parameter );Example See Also Java SyntaxVisual Basicfunction lr.get_attrib_long ( ByVal parameter as String ) as longExample See Also Visual Basic SyntaxThe lr_get_attrib_long function returns the value of a command line parameter whose type is longinteger when the script is run using the mdrv command. You place the command line parameter namein the function's argument field and lr_get_attrib_long returns the value of that parameter.The function returns NULL if the mdrv command line was not used to run the script (for example, thescript was run directly in VuGen or by LoadRunner). For more information on the running scripts usingthe mdrv command line, see the HP LoadRunner Virtual User Generator User Guide.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.

Page 79 of 337

Page 22: Lr Functions

lr_get_attrib_stringReturns a value of the calling mdrv command's parameter as a string.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_attrib_string

Return Values Parameterizationchar *lr_get_attrib_string (const char *argument);Example See AlsoJava LanguageString lr.get_attrib_string ( String parameter );Example See Also Java SyntaxVisual Basicfunction lr.get_attrib_string ( ByVal parameter as String ) as StringExample See Also Visual Basic SyntaxThe lr_get_attrib_string function returns a command line argument string when the script is runusing the mdrv command. You place the argument name in the function's argument field andlr_get_attrib_string returns the string values associated with that argument.The function returns NULL if the mdrv command line was not used to run the script (for example, thescript was run directly in VuGen or by LoadRunner). For more information on the running scripts usingthe mdrv command line, see the HP LoadRunner Virtual User Generator User Guide.The function returns NULL if the argument you specify is invalid. This is useful for checking if acommand line option or a specific value is valid.The Command Line Parsing Functions functions eliminate the need to parse the command line manually.argument A command line argument whose value is a string.

Page 80 of 337

lr_get_debug_messageReturns the current message logging settings.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_debug_message

Return Values Parameterizationunsigned int lr_get_debug_message ( );Example See AlsoJava Languageint lr.get_debug_message ( );Example See Also Java SyntaxVisual Basicfunction lr.get_debug_message ( ) as IntegerExample See Also Visual Basic SyntaxThe lr_get_debug_message function returns the current log run-time settings . The settingsdetermine what information is sent output. The log settings are specified with the run-time settingsdialog, or by using the lr_set_debug_message function.The debug messages are sent to the LoadRunner output window or Application Management agent log

Page 23: Lr Functions

file.To evaluate the returned value, you can perform a bitwise AND operation. This allows you todetermine which options are set. See the C syntax example.

Page 81 of 337

lr_get_host_nameReturns the name of the host.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_host_name

Return Values Parameterizationchar *lr_get_host_name ( );Example See AlsoJava LanguageString lr.get_host_name ( );Example See Also Java SyntaxVisual Basicfunction lr.get_host_name ( ) as StringExample See Also Visual Basic SyntaxThe lr_get_host_name function returns the name of the machine executing the script.

Page 82 of 337

lr_get_master_host_nameReturns the name of the Controller host.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_master_host_name

Return Values Parameterizationchar *lr_get_master_host_name ( );Example See AlsoJava LanguageString lr.get_master_host_name ( );Example See Also Java SyntaxVisual Basicfunction lr.get_master_host_name ( ) as StringExample See Also Visual Basic SyntaxThe lr_get_master_host_name function returns the name of the machine running the Controller .Not applicable for products that do not run Vusers.

Page 83 of 337

lr_get_transaction_durationReturns the duration of a transaction.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_transaction_duration

Return Values Parameterizationdouble lr_get_transaction_duration (const char *transaction);Example See AlsoVisual Basic

Page 24: Lr Functions

function lr.get_transaction_duration ( String transaction ) as doubleExample See Also Visual Basic SyntaxThe lr_get_transaction_duration function returns the duration in seconds of the specifiedtransaction to this point. You use this function to determine the total transaction time before thetransaction has ended. lr_get_transaction_duration returns values greater than zero only for opentransactions.This function returns the duration including Wasted Time. Therefore, the value may be slightly greaterthan the duration reported for the function when closed with lr_end_transaction.To determine other transaction statistics, such as think time and wasted time, use the TransactionFunctions.transaction A string indicating the name of a transaction.

Page 84 of 337

lr_get_transaction_statusReturns the current status of a transaction.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_transaction_status

Return Values Parameterizationint lr_get_transaction_status ( const char *transaction_name ) ;Example See Alsolr_get_transaction_status returns the current status of a transaction. lr_get_transaction_statuscannot be invoked after lr_end_transaction. Since lr_get_transaction_status can only return thestatus of an open transaction, it cannot report the final transaction status.This function can be useful when a transaction, which is made up of a number of steps, can fail atvarious points. By checking the status and terminating the Vuser, you can prevent unnecessaryactivity.transaction_name The name of the transaction.

Page 85 of 337

lr_get_transaction_think_timeReturns the think time of a transaction.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_transaction_think_time

Return Values Parameterizationdouble lr_get_transaction_think_time (const char *transaction);Example See AlsoVisual Basicfunction lr.get_transaction_think_time ( String transaction ) as doubleExample See Also Visual Basic SyntaxThe lr_get_transaction_think_time function returns the think time of the specified transaction untilthis point. It returns values greater than zero only for open transactions.

Page 25: Lr Functions

To determine other transaction statistics, such as think time and wasted time, use the appropriateTransaction Functions.transaction The transaction name .

Page 86 of 337

lr_get_transaction_wasted_timeReturns the wasted time of a transaction by its name.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_transaction_wasted_time

Return Values Parameterizationdouble lr_get_transaction_wasted_time (const char *transaction);Example See AlsoThe lr_get_transaction_wasted_time function returns the Wasted Time in seconds of the specifiedtransaction to this point.The lr_get_transaction_wasted_time function returns values greater than zero only for opentransactions.To determine other transaction statistics, such as think time and wasted time, use the appropriateTransaction Functions.transaction The name of the transaction.

Page 87 of 337

lr_get_trans_instance_durationReturns the duration of a transaction instance.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_trans_instance_duration

Return Values Parameterizationdouble lr_get_trans_instance_duration (long trans_handle);Example See AlsoThe lr_get_trans_instance_duration function returns the duration of an open transaction instancein seconds until this point. Use this function to determine the total transaction time before thetransaction has ended.The difference between this function and lr_get_transaction_duration is that here you specify atransaction instance by its handle. With lr_get_transaction_duration, you specify an independenttransaction by its name.The trans_handle is the return value of a call to lr_start_transaction_instance .lr_get_trans_instance_duration returns values greater than zero only for open transactions.To determine other transaction statistics, such as think time and wasted time, use the appropriateTransaction Functions.trans_handle A transaction handle.

Page 88 of 337

lr_get_trans_instance_status

Page 26: Lr Functions

Returns the current status of a transaction instance.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_trans_instance_status

Return Values Parameterizationint lr_get_trans_instance_status ( long transaction_handle ) ;Example See Alsolr_get_trans_instance_status returns the current status of a transaction instance.lr_get_trans_instance_status cannot be invoked after lr_end_transaction_instance . It cannotreport the final transaction instance status.The transaction_handle is the handle returned by the call to lr_start_transaction_instance thatcreated the instance.This function can be useful when a transaction instance, which is made up of a number of steps, canfail at various points of its execution. By checking the status and terminating the Vuser, you canprevent unnecessary activity.transaction_handle The name of the transaction.

Page 89 of 337

lr_get_trans_instance_think_timeReturns the think time of a transaction instance specified by its handle.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_trans_instance_think_time

Return Values Parameterizationdouble lr_get_trans_instance_think_time (long trans_handle);Example See AlsoThe lr_get_trans_instance_think_time function returns the think time of the specified transactionuntil this point.The difference between this function and lr_get_transaction_think_time is that here you specify atransaction instance by its handle. With lr_get_transaction_think_time, you specify an independenttransaction by its name.The trans_handle is the handle returned by the call to lr_start_transaction_instance that created theinstance.The lr_get_trans_instance_think_time function returns values greater than zero only for opentransactions.To determine other transaction statistics, such as think time and wasted time, use the appropriateTransaction Functions.trans_handle A transaction handle.

Page 90 of 337

lr_get_trans_instance_wasted_timeReturns the wasted time of a transaction instance.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_trans_instance_wasted_time

Return Values Parameterization

Page 27: Lr Functions

double lr_get_trans_instance_wasted_time (long trans_handle);Example See AlsoThe lr_get_trans_instance_wasted_time function returns the Wasted Time of the specifiedtransaction until this point.The difference between this function and lr_get_transaction_wasted_time is that here you specifya transaction instance by its handle. With lr_get_transaction_wasted_time, you specify anindependent transaction by its name.The trans_handle is the handle returned by the call to lr_start_transaction_instance that created theinstance.The lr_get_trans_instance_think_time function returns values greater than zero only for opentransactions.To determine other transaction statistics, such as think time and wasted time, use the appropriateTransaction Functions.trans_handle A transaction handle.

Page 91 of 337

lr_get_vuser_ipReturns the IP address of a Vuser.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_get_vuser_ip

Return Values Parameterizationchar *lr_get_vuser_ip( );Example See AlsoVisual Basicfunction lr.get_vuser_ip() as StringExample See Also Visual Basic SyntaxThe lr_get_vuser_ip function returns the IP address of a Vuser. When performing IP spoofing, eachVuser can use a different address. This function allows you to determine the current Vuser's IPaddress.If the IP was set with the web_set_sockets_option function using the IP_ADDRESS_BY_INDEXoption, lr_get_vuser_ip returns that IP.

Page 92 of 337

lr_load_dllLoads an external DLL.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_load_dll

Return Values Parameterizationint lr_load_dll (const char *library_name );Example See AlsoThe lr_load_dll function loads a DLL (Windows) or shared object (UNIX) allowing you to call an

Page 28: Lr Functions

external function when replaying using the C interpreter. Once you load the DLL, you can call anyfunction defined in the DLL, without having to declare it.You can specify a full path for the DLL.On Windows platforms, if you do not specify a path, lr_load_library searches for the DLL using thestandard sequence used by the C++ function, LoadLibrary .On UNIX platforms, you can set the LD_LIBRARY_PATH environment variable (or the platformequivalent). The lr_load_dll function uses the same search rules as dlopen. For more information, seethe man pages for dlopen or its equivalent.library_name The name of a DLL (Windows) or shared object (UNIX).

Page 93 of 337

lr_log_messageSends a message to the Application Management agent log file or the LoadRunner Vuser log.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_log_message

Return Values Parameterizationint lr_log_message (const char *format, exp1, exp2,...expn.);Example See AlsoJava Languageint lr.log_message ( String message );Example See Also Java SyntaxVisual Basicfunction lr.log_message ( ByVal message as String ) as IntegerExample See Also Visual Basic SyntaxThe lr_log_message function sends a message to the Vuser or agent log file (depending on theapplication), and not to the output window. You can use this function for debugging by sending erroror other informational messages to the log file.You can avoid overloading the network by using this function to send messages to the log file ratherthan sending messages to the Output window (with lr_error_message or lr_output_message). In astandalone program such as VuGen, lr_log_message sends the message to the viewer andoutput.txt.To send a message to the output file, you must enable logging in the run-time settings, and selectAlways send messages. If you select Send messages only when an error occurs, there is nooutput from this function.In the Vuser Execution log, this function does not list the location and line number from where themessage was issued. To issue a message with those details, use lr_output_message.formatC LanguageA formatted string to send to the log file. If it is a literal string, enclose it withquotation marks. Use the standard Message Formatting that is available for printf

Page 29: Lr Functions

to set the format for the expressions you want to print.exp1, exp2,..expnC LanguageThe expressions (variables) to be formatted and printed.messageObject orientedlanguagesA string containing the message to send to the log.See VB String Arguments and Java String Arguments.statement Outputlr_log_message("a message") a messagelr_output_message("message"); Action(4): a message

Page 94 of 337

lr_messageSends a message to the log and output window.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_message

Return Values Parameterizationint lr_message (const char *format, exp1, exp2,...expn.);Example See AlsoJava Languageint lr.message ( String message );Example See Also Java SyntaxVisual Basicfunction lr.message ( ByVal message as String ) as IntegerExample See Also Visual Basic SyntaxThe lr_message function sends a message to the log file and output window. When run in VuGen, theoutput file is output.txt.Use lr_log_message instead of this function to send the message only to the log file. This conservesthe network and controller resources required for sending messages to the output.To send a message to the output file, you must enable logging in the run-time settings, and selectAlways send messages. If you select Send messages only when an error occurs, there is nooutput from this function.In the log file, this function does not list the location and line number from where the message wasissued. To issue a message with those details, use lr_output_message.formatC LanguageA formatted string. If it is a literal string, enclose it with quotation marks. Use thestandard Message Formatting that are available for printf to set the format for theexpressions you want to print.exp1, exp2,..exp

Page 30: Lr Functions

nC LanguageThe expressions (variables) to be formatted and printed.messageObjectorientedA string containing the message to send to the Output window.See VB String Arguments and Java String Arguments.statement Outputlr_message("a message") a messagelr_output_message("a message"); Action(4): a message

Page 95 of 337

lr.missingReturns an Variant whose value is Missing.Java ScriptHP LoadRunner Online Function Reference > Utility Functions: Java Language (lr.) > lr.missing

Return Values ParameterizationVariant lr.missing ();Example See AlsoVB ScriptFunction lr.missing () as Variant;Example See AlsoUse lr.empty to pass an Missing variant to a function that requires a Variant argument.In Visual Basic, VB.NET or C#, use the class or keyword MISSING.

Page 96 of 337

lr_output_messageSends a message to log files, output windows, and other test report summaries.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_output_message

Return Values Parameterizationint lr_output_message (const char *format, exp1, exp2,...expn.);Example See AlsoJava Languageint lr.output_message ( String message );Example See Also Java SyntaxVisual Basicfunction lr.output_message ( ByVal message as String ) as IntegerExample See Also Visual Basic SyntaxThe lr_output_message function sends a message with the script section and line number to outputwindows (such as the LoadRunner output window), log files (such as the Vugen log file and theApplication Management Web site and agent log file), and other test report summaries.For details regarding the output for each product, see the products' user guides.When a script is run in VuGen, the output file is output.txt.To send an error message to the LoadRunner output window or Application Management agent log, use

Page 31: Lr Functions

the lr_error_message function. It is not recommended that you send a message to the output windowor agent log in the middle of a transaction, as it will lengthen the execution time. To send a messageto the Vuser execution log or Application Management Web site, but not to the Output window, uselr_log_message.To send a message to the output file, you must enable logging in the run-time settings, and selectAlways send messages. If you select Send messages only when an error occurs, there is nooutput from this function.To issue a message without including the location details, use lr_message.formatC LanguageA formatted string. If it is a literal string, enclose it with quotation marks. Use thestandard Message Formatting that is available for printf to set the format for theexpressions you want to print.exp1, exp2,..expnC LanguageThe expressions (variables) to be formatted and printed.messageObjectOrientedA string containing the message to send to the Output window.See VB String Arguments and Java String Arguments.statement Outputlr.log_message("a message") a messagelr.output_message("a message"); Actions.java (4): a messagePage 97 of 337

Note: Do not send null pointers as arguments to string formats e.g.char *str = NULL;lr_output_message("%s", str);

Page 98 of 337

lr_paramarr_idxReturns the value of the parameter at a specified location in a parameter array.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_paramarr_idx

Return Values Parameterizationchar * lr_paramarr_idx ( const char * paramArrayName, unsigned int index);Example See Alsolr_paramarr_idx returns a string containing the value of the parameter at the specified position in aparameter array. If the parameter does not exist, the return value is the concatenation of "{",

Page 32: Lr Functions

paramArrayName, "_", index, and "}", for example, "{myParam_4}".paramArrayName The name of the parameter array from which to return the value.index The one-based position of the parameter in the array.

Page 99 of 337

lr_paramarr_lenReturns the number of elements in a parameter array.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_paramarr_len

Return Values Parameterizationint lr_paramarr_len (const char * paramArrayName);Example See Alsolr_paramarr_len returns the number of elements in a parameter array.paramArrayName The name of the parameter array.

Page 100 of 337

lr_paramarr_randomReturns the value of the parameter at a random location in a parameter arrayC LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_paramarr_random

Return Values Parameterizationchar * lr_paramarr_random (const char * paramArrayName);Example See Alsolr_paramarr_random returns a string containing the value of the parameter in a parameter array.The value is returned from the parameter at a position chosen randomly by LoadRunner.paramArrayName The name of the parameter array.

Page 101 of 337

lr_param_incrementIncrements the value of a numerical parameter.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_param_increment

Return Values Parameterizationint lr_param_increment (const char *destination_param, const char *source_param);Example See AlsoThe lr_param_increment function retrieves the value of source_param, increments its value by one,and stores the incremented value as a null terminated string in destination_param.This function is useful only in protocols that have a numerical parameter type. For protocols that haveonly string parameters, increment with C functions. For example:i = at oi ( l r _eval _st r i ng( "{modi f i cat i on_num}" ) ) ;spr i nt f ( buf , "%d" , i +1) ;l r _save_st r i ng( buf , "next _modnum" ) ;For protocols that have a numerical parameter, lr_param_increment can be used:l r _par am_i nc r ement ( "next _modnum" , "{modi f i cat i on_num}" ) ;source_param must be initialized with an integer value prior to calling lr_param_increment.

Page 33: Lr Functions

source_param's value should include only single-byte digit characters with an optional sign or leadingzeros.When destination_param exists, its value is overwritten. When it doesn't exist, the parameter iscreated dynamically.The value of source_param is restricted to the maximum value of a long integer minus 1.destination_param The name of the parameter to store the incremented parametersource_param The name of the parameter whose value is incremented

Page 102 of 337

lr_param_sprintfWrites formatted output to a parameter.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_param_sprintf

Return Values Parameterizationint lr_param_sprintf ( const char * paramName, const char * format [,args ... ] );Example See Alsolr_param_sprintf functions like the standard C function sprintf except that the formatted string iswritten to a LoadRunner parameter instead of a string buffer.These formatting characters are not supported: %E, %hd, %hhd, %lld, %ld, %hhi, %lli, %hhu , %llu,%hhf , %llf, %hhe, and %lle.paramName The target parameter to which the string is written.format One or more formatting characters.args Optional print arguments.

Page 103 of 337

lr_param_uniqueGenerates a unique string and assigns it to a parameter.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_param_unique

Return Values Parameterizationint lr_param_unique (const char * paramName);Example See Alsolr_param_unique generates a string of format:<GroupName><UserID><CurrentTime>. The string contains no spaces.paramName The target parameter to which the string is written.

Page 104 of 337

lr_peek_eventsChecks for events.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_peek_events

Return Values Parameterizationvoid lr_peek_events ( );Example See AlsoJava Language

Page 34: Lr Functions

void lr.peek_events ( );Example See Also Java SyntaxVisual Basicsub lr.peek_events ( )Example See Also Visual Basic SyntaxThe lr_peek_events function suspends the Vuser script run and checks for events before resuming.Scripts written in C language perform this check internally. Therefore, there is no need to use thelr_peek_events function.Scripts written in Java or Visual Basic do not perform this check internally. Therefore, insert thisfunction into your Vuser script at the point at which you want the Vuser to pause.

Page 105 of 337

lr.read_xmlReturns the contents of an XML file as a string.Your cannot use standard parameterization with this function.Java and Java ScriptHP LoadRunner Online Function Reference > Utility Functions: Java Language (lr.) > lr.read_xml

String.lr.read_xml (String file_name);Example See AlsoThe lr.read_xml function returns the contents of the specified file as a String. If the call fails, itreturns null.file_name The file to read and return as a string. The file must exist in the data\SerializedObjectsdirectory under the script directory.

Page 106 of 337

lr_rendezvousCreates a rendezvous point in the Vuser script.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_rendezvous

Return Values Parameterizationint lr_rendezvous (const char *rendezvous_name);Example See AlsoJava Languageint lr.rendezvous ( String rendezvous_name );Example See Also Java SyntaxVisual Basicfunction lr.rendezvous ( ByVal rendezvous_name as String ) as IntegerExample See Also Visual Basic SyntaxThe lr_rendezvous function creates a rendezvous point in a Vuser script. When this statement isexecuted, the Vuser program stops and waits for permission from LoadRunner to continue.This function can only be used in action section, and not in vuser_init or vuser_end.The difference between lr_rendezvous and lr_rendezvous_ex is that lr_rendezvous alwaysreturns zero.

Page 35: Lr Functions

rendezvous_name The name of the rendezvous.

Page 107 of 337

lr_rendezvous_exCreates a rendezvous point in the Vuser script.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_rendezvous_ex

Return Values Parameterizationint lr_rendezvous_ex (const char *rendezvous_name);Example See AlsoThe lr_rendezvous_ex function creates a rendezvous point in a Vuser script. When this statement isexecuted, the Vusers stop and wait for permission from LoadRunner to continue.The default timeout is 30 sec. The timeout is set in the scenario policy in the Controller.This function can only be used in an action section, and not in vuser_init or vuser_end.The difference between this function and lr_rendezvous is that lr_rendezvous returns only LR_PASSor LR_FAIL.rendezvous_name The name of the rendezvous.

Page 108 of 337

Rendezvous Return ValuesThe return values of the lr_rendezvous function are defined in the Lrun.h file. On PC platforms, thefunction returns one of the values described in the table. On UNIX platforms, the function returns 0 forsuccess and -1 for an illegal name:HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > Rendezvous Return Values

Return Code Name Code MeaningLR_REND_ALL_ARRIVED 0 Vuser was released after all the designated Vusers arrived.LR_REND_TIMEOUT 1 Vuser was released after the timeout value was reached.LR_REND_DISABLED 2 The rendezvous was disabled from the Controller.LR_REND_NOT_FOUND 3 The rendezvous was not found.LR_REND_VUSER_NOT_MEMBER4 Vuser was not defined in the rendezvous.LR_REND_VUSER_DISABLED 5 Vuser was disabled for the rendezvous.LR_REND_BY_USER 6 The rendezvous was released by the user.

Page 109 of 337

lr_resume_transactionResumes reporting transaction data within a script.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_resume_transaction

Return Values Parameterizationvoid lr_resume_transaction (const char *transaction_name);Example See AlsoVisual BasicSub lr.resume_transaction ( String transaction_name )Example See Also Visual Basic Syntax

Page 36: Lr Functions

This function is retained for backward compatibility. For more general ways of reporting partialtransaction durations, see lr_start_sub_transaction, and lr_set_transaction.The lr_resume_transaction function resumes the reporting of transaction data within the script thatwas suspended by lr_stop_transaction. After a call to lr_stop_transaction, statistics returned by the"get" Transaction Functions reflect only the data up to that call, until this function is called.Data collection, however, is not interrupted. After the call to lr_resume_transaction, the "get"functions return all data since the start of the transaction. Furthermore, the final results when thetest is analyzed will reflect the total values, including the periods in between the transaction stop andresume.If lr_resume_transaction is not called, the "get" functions and the final results reflect only theduration from the transaction start to the lr_stop_transaction call. Thus, lr_stop_transaction andlr_resume_transaction can be used conditionally to collect information either about an entiretransaction, or only the beginning. To accomplish this, call lr_resume_transaction only if yourcondition is met.Note: When data is collected this way, the data in analysis will reflect both the tests where thecondition for lr_resume_transaction is met, and the tests where it is not.If the section you may wish to exclude ends before the end of the transaction, this technique doesnot apply. If you need to differentiate between occurrences where the lr_resume_transactioncondition is met and those where it is not in the analysis data, this technique does not apply.For other ways of recording durations conditionally, see lr_start_sub_transaction, andlr_set_transaction.transaction_name The name of the transaction.

Page 110 of 337

lr_resume_transaction_instanceResumes reporting transaction instance data within a scriptC LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_resume_transaction_instance

Return Values Parameterizationvoid lr_resume_transaction_instance ( long trans_handle );Example See AlsoThe lr_resume_transaction_instance function resumes the reporting of transaction data within thescript that was suspended by lr_stop_transaction_instance. After a call tolr_stop_transaction_instance, statistics returned by the "get" Transaction Functions reflect onlythe data up to that call, until this function is called.Data collection, however, is not interrupted. After the call to lr_resume_transaction_instance, the

Page 37: Lr Functions

"get" functions return all data since the start of the transaction. Furthermore, the final results whenthe test is analyzed will reflect the total values, including the periods in between the transactioninstance stop and resume.If lr_resume_transaction_instance is not called, the final results reflect the statistics only until thecall to lr_stop_transaction_instance.The parent_handle is the value returned from the call to lr_start_transaction_instance that createdthe instance.lr_stop_transaction_instance and lr_resume_transaction_instance can be used to conditionallycollect information about either the beginning, or all of the transaction.Note that you will not be able to differentiate in analysis between iterations whenlr_stop_transaction_instance was called and iterations where it was not.For more flexible ways recording transaction times conditionally, see lr_start_sub_transaction,lr_set_transaction,and lr_start_timertrans_handle The transaction instance id that was returned by lr_start_transaction_instance

Page 111 of 337

lr_save_datetimeAssigns the current date and time to a parameter.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_save_datetime

Return Values Parameterizationvoid lr_save_datetime(const char *format, int offset, const char *name);Example See AlsoThe lr_save_datetime function saves the current date and time, or the date and time with thespecified offset into a parameter. The resulting string will be truncated once it reachesMAX_DATETIME_LEN characters.The format can be a format defined in an included header file, such as DATE_FM, which is defined inlrun.h. You can use theDatetime Format Codes to build a format with any combination of strings andcodes. For example, depending on the definitions in your computer's locale, "The current month is %b"would return The current month is JAN. "%d%b%y" would return 29JAN97.format The format of the retrieved date/time information.offset Offset from the current date and time, using the constants: DATE_NOW, TIME_NOW,ONE_DAY, ONE_HOUR, ONE_MIN. For example, TIME_NOW + ONE_HOURname The name of the parameter to store the date/time information.

Page 112 of 337

lr.save_doubleSaves a double value as a parameter.Visual Basic and VB ScriptHP LoadRunner Online Function Reference > Utility Functions: VB, VB Script (lr.) > lr.save_double

Page 38: Lr Functions

Return Values ParameterizationSub lr.save_double (ByVal param_name as String, value as Double )Example See Also Visual Basic SyntaxThe lr.save_double function saves value to parameter param_name. It creates the parameter if itdoes not exist.param_name The parameter in which to save the valuevalue A numeric value

Page 113 of 337

lr_save_int.

Saves an integer to a parameter.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_save_int

Return Values Parameterizationint lr_save_int ( int value, const char *param_name);Example See AlsoThe lr_save_int function converts an integer to a string and saves the string in a parameter. If theparameter does not exist, it is created.value The integer value to assign to the parameter.param_name The name of the parameter.

Page 114 of 337

lr.save_longSaves a long value as a parameter.Visual Basic and VB ScriptHP LoadRunner Online Function Reference > Utility Functions: VB, VB Script (lr.) > lr.save_long

Return Values ParameterizationSub lr.save_long (ByVal param_name as String, value as long )Example See Also Visual Basic SyntaxThe lr.save_long function saves value to parameter param_name. It creates the parameter if it doesnot exist.param_name The parameter in which to save the valuevalue An integer or long integer value

Page 115 of 337

lr_save_searched_stringSearches for an occurrence of a string in a buffer and saves a portion of the buffer after that string toa parameter.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_save_searched_string

Return Values Parameterizationint lr_save_searched_string (const char *buffer, long buf_size, unsigned int occurrence,const char *search_string, int offset, unsigned int string_len, const char*parm_name );Example See Also

Page 39: Lr Functions

The lr_save_searched_string function searches for string search_string inside string or characterarray buffer, and finds the nth occurrence of search_string, where n is occurrence plus 1. The substringto be saved starts at offset after the end of the nth occurrence of search_string, and haslength string_len.For example:char cBuf f [ ] = " abc Emma Woodhouse abc El i zabet h Bennet abc Wi l l i am Pr i ce" ;l r _s ave_s ear c hed_s t r i ng( cBuf f , st r l en( cBuf f ) ,2, " abc" , / / Sear ch f or t hi r d occur r ence of " abc"1, / / Ski p t he space af t er " abc"4, / / Put t he next f our char act er s. . ." Fannys_br ot her " ) ; / / . . . i n par amet er Fannys_br ot her .Af t er t he cal l , t he cont ent of par amet er Fannys_br ot her i s "Wi l l " .The search_string cannot contain null characters, but the buffer can contain null characters.Use the lr_save_string function to save strings from character arrays. Use lr_save_searched_stringonly when you need to save a portion of a character array relative to a string occurrence.buffer The STRING or CARRAY buffer, part of whose contents you want to save.buf_size The buffer size.occurrence The occurrence number of the search_string (0-based count). For example, if thesearch_string occurs three times, and you want the second occurrence, setoccurrence to 1.search_string The string to search for in the buffer.offset The number of characters to skip after the end of the search string occurrence.string_len The number of characters to save.parm_name Parameter name to be used in subsequent lr statements to refer to the savedinformation. Name is enclosed in double-quotes.

Page 116 of 337

lr_save_stringSaves a null-terminated string to a parameter.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_save_string

Return Values Parameterizationint lr_save_string (const char *param_value, const char *param_name);Example See AlsoJava Languageint lr.save_string ( String param_value , String param_name);Example See Also Java SyntaxVisual Basicfunction lr.save_string ( ByVal param_name as String, ByVal param_value as String ) asIntegerExample See Also Visual Basic SyntaxThe lr_save_string function assigns the specified null-terminated string to a parameter. This function

Page 40: Lr Functions

is useful in correlating queries. To determine the value of the parameter, use the lr_eval_stringfunction.param_value The value to assign to the parameter.param_name The name of the parameter.

Page 117 of 337

lr_save_varSaves a variable length string to a parameter.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_save_var

Return Values Parameterizationint lr_save_var (const char *param_value, unsigned long const value_len, unsigned longconst options, const char *param_name);Example See AlsoThe lr_save_var function assigns the specified variable length string to a parameter. This function isuseful in correlating queries. To determine the value of the parameter, use the lr_eval_string function.param_value The value to assign to a parameter.value_len The length of the value in bytes.options A parameter option, currently 0.param_name The name of the parameter.

Page 118 of 337

lr_set_debug_messageSets the message level for the script execution.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_set_debug_message

Return Values Parameterizationint lr_set_debug_message (unsigned int message_level, unsigned int on_off);Example See AlsoJava Languageint lr.set_debug_message ( int message_level, int on_off );Example See Also Java SyntaxVisual Basicfunction lr.set_debug_message ( ByVal message_level as Integer, ByVal on_off asInteger ) as IntegerExample See Also Visual Basic SyntaxThe lr_set_debug_message function sets the debug message level, message_lvl, for the scriptexecution. By setting a message level, you determine which information is sent. The setting is enabledby passing LR_SWITCH_ON as on_off , and disabled with LR_SWITCH_OFF.The messages are sent to the Application Management agent log or the LoadRunner Vuser output.Message levels are generally set in the script's Run-time Settings dialog box. The value can be

Page 41: Lr Functions

changed from the current Run-time Settings value. For example, if the script's current message level inthe Run-time Settings is set at "Brief" mode, the value can be increased to "Extendedlog" (LR_MSG_CLASS_EXTENDED_LOG):l r _set _debug_message( LR_MSG_CLASS_EXTENDED_LOG, LR_SWI TCH_ON)and later decreased to "Brief" once again:l r _set _debug_message( LR_MSG_CLASS_EXTENDED_LOG, LR_SWI TCH_OFF)To enable logging that is disabled in the Run-time Settings, set the message level to another level. Forexample:l r . set _debug_message ( l r . MSG_CLASS_EXTENDED_LOG, l r . SWI TCH_ON) ;After enabling the logging, return to the disabled state by setting the debug level to zero (0) andactivating the option using the lr.SWITCH_ON switch as the second parameter.The message levels Result Data, Parameter Substitution, and Full Trace, are specific details, or subsettings,of the Extended log setting. To set one of these sub-settings you can use logical Or's in yourmessage_level argument.Using LR_SWITCH_DEFAULT as on_off sets the on/off status of message_level to the default valueregardless of previous calls to lr_set_debug_message. Use LR_SWITCH_DEFAULT with a singlemessage_level argument. It does not work with ORed message_level settings.message_level One of the Message Log Run-Time Settings.on_off A switch to activate or deactivate a specific message level setting. Use one of theOn-Off Constants.Page 119 of 337

Page 120 of 337

lr_set_transactionCreates a completed transaction.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_set_transaction

Return Values Parameterizationint lr_set_transaction(const char *name, double duration, int status);Example See AlsoJava Languageint lr.set_transaction( String name, double duration, int status);Example See Also Java SyntaxVisual BasicFunction lr.set_transaction( String name, double duration, int status) as integerExample See Also Visual Basic SyntaxThe lr_set_transaction function creates a transaction, its duration, and status in a single call. Use itwhere the business process you want to capture in a transaction does not consist of sequential steps,or where you may or may not want to create a transaction, depending on conditions that are knownonly during the test.

Page 42: Lr Functions

To create a transaction for non-sequential steps, capture the duration of each series of steps thatparticipate in the business process. Sum the durations and create the transaction withlr_set_transaction.To capture durations in C language scripts, use lr_start_timer and lr_end_timer. For other languages,use the native language time functions.lr_set_transaction can also be used to report the duration of a failed transaction by saving theduration before the transaction fails with lr_get_transaction_duration then using lr_set_transactionto create a new transaction for reporting that time.lr_set_transaction creates and closes the transaction. Therefore, no functions that work only onopen transactions are applicable.Note: Do not use the period character (.) in a transaction name. The period character delimitstransactions and sub-transactions. In analysis, a transaction name with a period will be interpreted astwo transactions.Name A name for the transaction.duration Transaction duration in seconds.status The transaction completion status. One of theTransaction Status constants for pass, fail,or stop.The auto status is not applicable.

Page 121 of 337

lr_set_transaction_instance_statusSets the status of a transaction instance.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_set_transaction_instance_status

Return Values Parameterizationint lr_set_transaction_instance_status (int status, long trans_handle);Example See AlsoThe lr_set_transaction_instance_status function sets the status of the open transaction with thetransaction handle trans_handle. The handle was returned by lr_start_transaction_instance .This transaction's lr_end_transaction_instance statement must use automatic status assignment bypassing a Transaction Status of auto as its status parameter.A transaction's status is defined in the status parameter of lr_end_transaction_instance. If this statusis LR_AUTO the value is automatically assigned. By default, this value is LR_PASS signifying asuccessful transaction. lr_set_transaction_instance_status changes this default value to status.For more information on transaction instances, see lr_start_transaction_instance.status One of theTransaction Status constants for pass, fail, or stop.The auto status is not applicable.trans_handle The handle to a transaction instance

Page 43: Lr Functions

Page 122 of 337

lr_set_transaction_statusSets the default end status of open transactions.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_set_transaction_status

Return Values Parameterizationint lr_set_transaction_status (int status);Example See AlsoJava Languageint lr.set_transaction_status ( int status);Example See Also Java SyntaxThe lr_set_transaction_status function sets the status of those transactions currently open whichhave LR_AUTO in their lr_end_transaction statement.A transaction's status is defined in the status parameter of lr_end_transaction. If this status isLR_AUTO, the value is automatically assigned. By default, this value is LR_PASS, signifying asuccessful transaction. lr_set_transaction_status changes this default value to status.status One of theTransaction Status constants for pass, fail, or stop.The auto status is not applicable.

Page 123 of 337

lr_set_transaction_status_by_nameSets the default end status of a single transaction.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_set_transaction_status_by_name

Return Values Parameterizationint lr_set_transaction_status_by_name (int status, const char *trans_name);Example See AlsoThe lr_set_transaction_status_by_name function sets the default status of the open transactionwith name trans_name. This transaction's lr_end_transaction statement must use automatic statusassignment by passing LR_AUTO as its status parameter.A transaction's status is defined in the status parameter of lr_end_transaction. If this status isLR_AUTO, the value is automatically assigned. By default, this value is LR_PASS, signifying asuccessful transaction. lr_set_transaction_status_by_name changes this default value to status.status One of theTransaction Status constants for pass, fail, or stop.The auto status is not applicable.trans_name The transaction name

Page 124 of 337

lr_start_sub_transactionStarts a sub-transaction specified by its parent's name.C Language

Page 44: Lr Functions

HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_start_sub_transaction

Return Values Parameterizationint lr_start_sub_transaction (const char *sub_transaction, const char*parent_transaction);Example See AlsoJava Languageint lr.start_sub_transaction (String sub_transaction, String parent_transaction);Example See Also Java SyntaxVisual BasicFunction lr.start_sub_transaction (String sub_transaction, String parent_transaction) asIntegerExample See Also Visual Basic SyntaxThe lr_start_sub_transaction function marks the beginning of a sub-transaction. To mark the end ofthe sub-transaction, use lr_end_sub_transaction. You insert these functions immediately before andafter the sub-transaction actions.Sub-transactions are used for isolating parts of a business process. For example, a sub-transaction"electrical_purchases" may be nested within the larger transaction "purchases." The transaction"purchases" is the parent transaction and "electrical_purchases" the sub-transaction.Multiple sub-transactions can be nested within a parent transaction. A sub-transaction may also be aparent to a smaller sub–transaction.The duration of a transaction or sub-transaction is the sum of the durations of all steps between itsstart and end, including the steps that are included in sub-transactions.Each lr_start_sub_transaction statement must be matched with an lr_end_sub_transactionstatement within the script or it will be interpreted as an illegal command.Note: Do not use the period character (.) in a transaction or sub-transaction name. The periodcharacter delimits transactions and sub-transactions. In analysis, a transaction name with a periodwill be interpreted as two transactions.sub_transaction The name of the sub-transactionparent_transaction The name of the parent transaction in which the sub-transaction is nested.

Page 125 of 337

lr_start_timerStarts a timer.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_start_timer

Return Values Parameterizationmerc_timer_handle_t lr_start_timer ();Example See Alsolr_start_timer starts a timer that calculates the passage of time in seconds. The resolution depends

Page 45: Lr Functions

on the run-time environment. The maximum resolution is a microsecond.lr_start_timer returns a handle to the timer. Pass the handle to lr_end_timer to stop the timer.

Page 126 of 337

lr_start_transactionMarks the beginning of a transaction.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_start_transaction

Return Values Parameterizationint lr_start_transaction ( const char *transaction_name );Example See AlsoJava Languageint lr.start_transaction ( String transaction_name );Example See Also Java SyntaxVisual Basicfunction lr.start_transaction ( ByVal transaction_name as String ) as IntegerExample See Also Visual Basic SyntaxThe lr_start_transaction function marks the beginning of a transaction. To indicate a transaction tobe analyzed, use the lr_start_transaction and lr_end_transaction functions. These functions areinserted immediately before and after the transaction.Transactions can be nested, but each lr_start_transaction statement must be associated with anlr_end_transaction statement or it will be interpreted as an illegal command.Note: Do not use the period character (.) in a transaction or sub-transaction name. The periodcharacter delimits transactions and sub-transactions. In analysis, a transaction name with a periodwill be interpreted as two transactions.transaction_name The name of the transaction.

Page 127 of 337

lr_start_transaction_instanceStarts a transaction instance.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_start_transaction_instance

Return Values Parameterizationlong lr_start_transaction_instance ( const char *transaction_name, long handle);Example See AlsoThe lr_start_transaction_instance function marks the beginning of a transaction instance. Atransaction instance is an occurrence of a transaction with transaction_name. Instances areidentified by their handle which distinguishes them from other instances of the same transaction.This function enables multiple instances of a transaction to be created. Use transaction instances

Page 46: Lr Functions

when the same transaction is required to be performed under different circumstances and an analysisof each circumstance is required.By passing the handle of a parent transaction instance, the new instance will be considered a subtransactioninstance of the parent. Pass zero as the handle if there is no parent. For more informationon sub-transactions, see lr_start_sub_transaction.The function returns the handle of the transaction instance which identifies the instance. Note thateach lr_start_transaction_instance statement must be matched with anlr_end_transaction_instance statement or it will be interpreted as an illegal command.Note: Do not use the period character (.) in a transaction or sub-transaction name. The periodcharacter delimits transactions and sub-transactions. In analysis, a transaction name with a periodwill be interpreted as two transactions.transaction_name The name of the transaction.handle The parent transaction's handle. A value of 0 instructs VuGen to create a newparent transaction.

Page 128 of 337

lr_stop_transactionFreezes reporting of transaction data.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_stop_transaction

Return Values Parameterizationdouble lr_stop_transaction (const char *transaction_name);Example See AlsoVisual BasicFunction lr.stop_transaction ( String transaction_name ) as DoubleExample See Also Visual Basic SyntaxThis function is retained for backward compatibility. For more general ways of reporting partialtransaction durations, see lr_start_sub_transaction, and lr_set_transaction.After a call to lr_stop_transaction, statistics returned by the "get" Transaction Functions reflectonly the data up to the call, until lr_resume_transaction is called. The specified transaction must havebeen opened with lr_start_transaction.Data collection, however, is not interrupted. After the call to lr_resume_transaction, the "get"functions return all data since the start of the transaction. Furthermore, the final results when thetest is analyzed will reflect the total values, including the periods in between the transaction stop andresume.If lr_resume_transaction is not called, the "get" functions and the final results reflect only theduration from the transaction start to the lr_stop_transaction call. Thus, lr_stop_transaction and

Page 47: Lr Functions

lr_resume_transaction can be used conditionally to collect information either about an entiretransaction, or only the beginning. To accomplish this, call lr_resume_transaction only if yourcondition is met.Note: When data is collected this way, the data in analysis will reflect both the tests where thecondition for lr_resume_transaction is met, and the tests where it is not.If the section you may wish to exclude ends before the end of the transaction, this technique doesnot apply. If you need to differentiate between occurrences where the lr_resume_transactioncondition is met and those where it is not in the analysis data, this technique does not apply.transaction_name The name of an open transaction.

Page 129 of 337

lr_stop_transaction_instanceFreezes reporting statistics for a transaction instance specified by its handle.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_stop_transaction_instance

Return Values Parameterizationdouble lr_stop_transaction_instance (long parent_handle);Example See AlsoAfter a call to lr_stop_transaction_instance, statistics returned by the "get" Transaction Functionsreflect only the data up to the call, until lr_resume_transaction_instance is called. The specifiedtransaction instance must have been opened with lr_start_transaction_instance.Data collection, however, is not interrupted. After the call to lr_resume_transaction_instance, the"get" functions return all data since the start of the transaction instance. Furthermore, the finalresults when the test is analyzed will reflect the total values, including the periods in between thetransaction stop and resume.If lr_resume_transaction_instance is not called, the final results reflect the statistics only until thecall to lr_stop_transaction_instance.The parent_handle is the value returned from the call to lr_start_transaction_instance that createdthe instance.lr_stop_transaction_instance and lr_resume_transaction_instance can be used to conditionallycollect information about either the beginning, or all of the transaction.Note that you will not be able to differentiate in analysis between iterations whenlr_stop_transaction_instance was called and iterations where it was not.For more flexible ways recording transaction times conditionally, see lr_start_sub_transaction,lr_set_transaction,and lr_start_timer.lr_stop_transaction_instance returns the duration of the instance in seconds.parent_handle A unique transaction handle.

Page 130 of 337

Page 48: Lr Functions

lr_think_timePauses execution between commands in a script.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_think_time

Return Values Parameterizationvoid lr_think_time (double thinkTime);Example See AlsoJava Languagevoid lr.think_time ( double thinkTime );Example See Also Java SyntaxVisual Basicsub lr.think_time ( ByVal thinkTime as Double )Example See Also Visual Basic Syntaxlr_think_time allows you to pause test execution during a run. This is especially useful in simulatingthink time, the time a real user pauses to think between actions.thinkTime The length of the pause, in seconds.

Page 131 of 337

lr_user_data_pointRecords a user-defined data sample.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_user_data_point

Return Values Parameterizationint lr_user_data_point (const char *sample_name, double value);Example See AlsoJava Languageint lr.user_data_point ( String sample_name, double value );Example See Also Java SyntaxVisual Basicfunction lr.user_data_point ( ByVal sample_name as String, ByVal value as double ) asIntegerExample See Also Visual Basic SyntaxThe lr_user_data_point function allows you to record your own data for analysis. Each time youwant to record a point, use this function to record the sample name and the value. The time that thesample is recorded automatically. After the execution, you can use the User Defined Data Points graphto analyze the results.Note: The following prefixes in sample_name are reserved:HTTPNON_HTTPRETRYmic_stream_mms_A data point with any of these prefixes, for example "HTTP_BT", will not appear on the graph.

Page 49: Lr Functions

However, the prefixes are case-sensitive, therefore "http_BT" is a valid sample_name.sample_name The data point name.value The value to record.

Page 132 of 337

lr_user_data_point_exRecords a user-defined data sample and enables logging option.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_user_data_point_ex

Return Values Parameterizationint lr_user_data_point_ex ( const char *sample_name, double value, int log_flag);Example See AlsoThe lr_user_data_point_ex function is the same as lr_user_data_point except for the additionalparameter log_flag.Logging means writing data to a file. lr_user_data_point_ex enables you to write a data point to theVuser log file. When run in VuGen, the output is output.txtYou may want to write the data point conditionally according to how important the data to be loggedis. It can either be part of a Standard level when only the most important information is logged or anExtended level, when fuller logging is required.log_flag denotes the log level and correlates to the settings found in VuGen's Log runtime settingwhich specifies how the script handles logging to a file during execution. If DP_FLAGS_EXTENDED_LOGis passed to lr_user_data_point_instance_ex then the data point is logged only when the Extendedruntime Log setting is currently activate. If log_flag is DP_FLAGS_STANDARD_LOG then it will be loggedonly if the Standard setting is active. DP_FLAGS_NO_LOG indicates that this data point is neverwritten to a log file.sample_name A string indicating the name of the sample type.value The value to record.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_instanceRecords a user-defined data sample and correlates it to a transaction instance.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_user_data_point_instance

Return Values Parameterizationlong lr_user_data_point_instance (const char *sample_name, double value, longtransaction_handle);Example See Also

Page 50: Lr Functions

The lr_user_data_point_instance function is similar to lr_user_data_point except for itstransaction_handle parameter which allows you to associate a data point with a specific transactioninstance.This function is intended for use with applications integrated with LoadRunner that use transactioninstances.For details on transaction instances, see lr_start_transaction_instance.sample_name A string indicating the name of the sample type.value The value to record.parent_handle A transaction instance identifier with which to associate the data_point.

Page 134 of 337

lr_user_data_point_instance_exRecords a user-defined data sample and correlates it to a transaction instance.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_user_data_point_instance_ex

Return Values Parameterizationlong lr_user_data_point_instance_ex (const char* sample_name, double value, longtransaction_handle, int log_flag);Example See AlsoThe lr_user_data_point_instance_ex function is the same as lr_user_data_point_instance exceptfor the additional parameter log_flag.Logging means writing data to a file. lr_user_data_point_instance_ex enables you to write a datapoint to the Vuser log file. When run in VuGen, the output is output.txtYou may want to write the data point conditionally according to the importance of the data to belogged. It can either be part of a Standard level when only the most important information is logged oran Extended level, when fuller logging is required.log_flag denotes the log level and correlates to the settings found in VuGen's Log runtime settingwhich specifies how the script handles logging to a file during script execution. IfDP_FLAGS_EXTENDED_LOG is passed to lr_user_data_point_instance_ex then the data point islogged only when the Extended runtime Log setting is activate. If log_flag isDP_FLAGS_STANDARD_LOG then it will be logged only if the Standard setting is active.DP_FLAGS_NO_LOG indicates that this data point is never written to a log file.sample_name A string indicating the name of the sample type.value The value to record.parent_handle A transaction instance identifier with which to associate the data_point.log_flag Determines whether the data point should be logged or not:DP_FLAGS_NO_LOG (1)DP_FLAGS_STANDARD_LOGDP_FLAGS_EXTENDED_LOG (3)

Page 135 of 337

Page 51: Lr Functions

lr.vuser_groupReturns the name of the Vuser group.Visual Basic and VB ScriptHP LoadRunner Online Function Reference > Utility Functions: VB, VB Script (lr.) > lr.vuser_group

Return Values ParameterizationFunction lr.vuser_group ( ) as StringExample See Also Visual Basic SyntaxThe lr.vuser_group function returns the name of the Vuser group to which the Vuser belongs.

Page 136 of 337

lr.vuser_idReturns the Vuser ID.Visual Basic and VB ScriptHP LoadRunner Online Function Reference > Utility Functions: VB, VB Script (lr.) > lr.vuser_id

Return Values ParameterizationFunction lr.vuser_id ( ) as LongExample See Also Visual Basic SyntaxThe lr.vuser_id function returns the ID of the running Vuser.

Page 137 of 337

lr_vuser_status_messageSends a message to the Vuser status area.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_vuser_status_message

Return Values Parameterizationint lr_vuser_status_message (const char *format);Example See AlsoJava Languageint lr.vuser_status_message ( String message );Example See Also Java SyntaxVisual BasicFunction lr.vuser_status_message ( message As String ) as IntegerExample See Also Visual Basic SyntaxThe lr_vuser_status_message function sends a string to the Status area of the Controller. It alsosends this string to the Vuser log. When run from VuGen, the message is sent to output.txt.

Page 138 of 337

lr_wasted_timeRemoves wasted time from all open transactions.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_wasted_time

Return Values Parameterizationvoid lr_wasted_time (long wasteTime);Example See AlsoOther languagesSee lr_set_transaction for an alternative.

Page 52: Lr Functions

lr_wasted_time allows you to subtract the time wasted on incidental or secondary actions from allopen transactions.For more information, see Wasted Time.wasteTime The time in milliseconds to be removed from all open transactions.

Page 139 of 337

lr_whoamiReturns information about the Vuser executing the script.C LanguageHP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > lr_whoami

Return Values Parameterizationvoid lr_whoami (int *vuser_id, char **sgroup, int *scid);Example See AlsoThe lr_whoami function gets information about the Vuser.Note that the sgroup parameter is a pointer to constant data and should only be read, not altered.Memory for the string is allocated automatically. You do not have to allocate explicitly in the script.If you do not want to retrieve one or more of the parameters, replace the parameter name with NULL.Not applicable for products that do not run individual Vusers.vuser_id A pointer to an output argument to store the Vuser ID number.sgroup A pointer to an output argument to store the name of the Vuser Group.scid A pointer to an output argument to store the Scenario or Session step ID number.

Page 140 of 337

Message FormattingThe first character of the format parameter is always a percent sign (%). The last character offormat is a letter code that determines the type of formatting. One or more format modifiers canappear between the first and last character of the format argument (see below). The possible lettercodes are as follows:Note that a separate formatting specification must be provided for each expression to be printed. Forexample, the statement:printf("My name is %s%s\n", "Arthur", "Dent");prints the statement "My name is Arthur Dent" to standard output. Without the second "%s," thesecond expression (Dent) would have been ignored.The output generated by a particular formatting code can be modified. Three types of modifiers canappear between the percent sign (%) and the format code character:HP LoadRunner Online Function Reference > Utility Functions: C Language (LR) > Message Formatting

Character ArgumentTypePrinted Asd,i int decimal numbero int unsigned octal number without a leading zerox,X int unsigned hexadecimal number without a leading 0x

Page 53: Lr Functions

u int unsigned decimal numberc int single characters char * print characters until either `\0' or the number of characters given inthe precision is reachede,E double engineering notation (m.dddddd e+exponent). If precision is greaterthan fractional part, prints trailing zerosg,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, by itself or to the left of a decimal point, indicates how many charactersthe field should be padded. When this number is preceded by a 0, the paddingoccurs with zeros to the left of the printed value.precision A number to the right of a decimal point indicates the maximum width of the printedstring or how many digits are printed to the right of the output decimal point.

Page 141 of 337

Message Log Run-Time SettingsThere 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: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 LanguageConstantsObject Oriented Constants ValueDisabled LR_MSG_CLASS_DISABLE_LOGlr.MSG_CLASS_DISABLE_LOG0Brief LR_MSG_CLASS_BRIEF_LOGlr.MSG_CLASS_BRIEF_LOG1Extended Log LR_MSG_CLASS_EXTENDED_LOGlr.MSG_CLASS_EXTENDED_LOG16Log Level C LanguageConstantsObject Oriented Constants ValueResult Data LR_MSG_CLASS_RESULT_DATAlr.MSG_CLASS_RESULT_DATA2ParameterSubstitution

Page 54: Lr Functions

LR_MSG_CLASS_PARAMETERSlr.MSG_CLASS_PARAMETERS4Full Run-TimeTraceLR_MSG_CLASS_FULL_TRACElr.MSG_CLASS_FULL_TRACE8Log Level C LanguageConstantsObject OrientedConstantsValueOnly on error.Which messages sent on error depends onother settings.LR_MSG_CLASS_JIT_LOG_ON_ERRORlr.MSG_CLASS_JIT_LOG_ON_ERROR512

Page 142 of 337

On-Off ConstantsThese are the constants for activating and deactivating settings:HP LoadRunner Online Function Reference > Utility Functions: Socket ID Functions > On-Off Constants

Action C LanguageConstantsObject Oriented Constants ValueTurns the setting off. LR_SWITCH_OFFlr.SWITCH_OFF0Turns the setting on. LR_SWITCH_ONlr.SWITCH_ON1Uses the defaults from the script's cfg file. LR_SWITCH_DEFAULTlr.SWITCH_DEFAULT2

Page 143 of 337

Parameterization Background

Page 55: Lr Functions

For information about the arguments that are available for parameterization, click theParameterization button in that function.HP LoadRunner Online Function Reference > Utility Functions: Socket ID Functions > Parameterization Background

Page 144 of 337

Raw Body AttributeBinary content can be sent in the request using the BodyBinary attribute (or the Body attributewhen "Binary=1" is also specified). However, this method requires that content is converted into ASCIItext using escape backslashes for non–printable text.To enable a more simple representation of the raw data, the Raw Body attribute instead enables youto pass a pointer to the binary content.The syntax for sending raw body content is a set of 4 arguments to web_custom_request(). Theymust appear in the following order:The correct order is:RAW_BODY_START,a poi nt er t o t he dat a buf f er ,( i nt ) l engt h,RAW_BODY_ENDThe syntax is illustrated in the following example:char *abc= . . . / * a poi nt er t o t he r aw dat a */web_cust om_r equest ( "St epName" ,"URL=ht t p: / / some. ur l " ,"Met hod=POST" ,RAW_BODY_START," abc" ,3,RAW_BODY_END,LAST) ;The pointer data buffer must not be NULL, even when the length is 0.The Raw Body group cannot be used with the Binary parameter set ("Binary=1").The data buffer cannot be parameterized. That is, any parameter reference (e.g., "{MyParam}") in thedata buffer will not be substituted with the corresponding parameter value, and will be used as is.HP LoadRunner Online Function Reference > Utility Functions: Socket ID Functions > Raw Body Attribute

Page 145 of 337

Script Continuation OptionsScripts exit with one of these options for continuation:Note: The behavior of LR_EXI T_MAI N_I TERATION_AND_CONTI NUE andLR_EXI T_I TERATION_AND_CONTI NUE changed between versions 8.0 and 8.1. These options can beconfigured by using these run options:-main_iteration_exit: Both LR_EXI T_MAI N_I TERATION_AND_CONTI NUE andLR_EXI T_I TERATION_AND_CONTI NUE behave like LR_EXI T_MAI N_I TERATION_AND_CONTI NUE. Thi swas t he behavi or bef or e ver si on 8. 1.-block_iteration_exit: Both LR_EXI T_MAI N_I TERATION_AND_CONTI NUE andLR_EXI T_I TERATION_AND_CONTI NUE behave like LR_EXI T_I TERATION_AND_CONTI NUE

Page 56: Lr Functions

Add these flags in the [action_logic] section in mdrv.dat:ExtCmdLine=-main_iteration_exitorExtCmdLine=-block_iteration_exitHP LoadRunner Online Function Reference > Utility Functions: Socket ID Functions > Script Continuation Options

C Constants Object OrientedConstantsBehaviorLR_EXIT_VUSER lr.EXIT_VUSER Exit without any condition, and go directly to endactionLR_EXIT_ACTION_AND_CONTINUElr.EXIT_ACTION_AND_CONTINUEStop current action, and go to the next action.LR_EXIT_MAIN_ITERATION_AND_CONTINUElr.EXIT_MAIN_ITERATION_AND_CONTINUEStop current global script run iteration, and go tothe next iteration.LR_EXIT_ITERATION_AND_CONTINUElr.EXIT_ITERATION_AND_CONTINUEStop current iteration, and go to the next iteration.If called from within a block iteration, only the blockiteration will be exited, and not the global iteration.LR_EXIT_VUSER_AFTER_ITERATIONlr.EXIT_VUSER_AFTER_ITERATIONRun until the end of the current iteration and thenexit.LR_EXIT_VUSER_AFTER_ACTIONlr.EXIT_VUSER_AFTER_ACTIONRun until the end of the current action and thenexit.

Page 146 of 337

Script Exit StatusScripts exit with one of these statuses:HP LoadRunner Online Function Reference > Utility Functions: Socket ID Functions > Script Exit Status

C Constants Object Oriented ConstantsLR_PASS lr.PASSLR_FAIL lr.FAILLR_AUTO lr.AUTO

Page 147 of 337

Transaction Status

Page 57: Lr Functions

Transactions complete with one of these statuses. The status can be read before completion, butmay change at any time until the transaction completes.HP LoadRunner Online Function Reference > Utility Functions: Socket ID Functions > Transaction Status

C Constants Object Oriented ConstantsLR_PASS lr.PASSLR_FAIL lr.FAILLR_AUTO lr.AUTOLR_STOP lr.STOP

Visual Basic SyntaxString ArgumentsArgument ListsSpecial Characters