Y-lib
Loadrunner libraries
|
ylib transaction library. More...
#include "web_api.h"
#include "vugen.h"
#include "y_logging.c"
#include "y_string.c"
#include "y_loadrunner_utils.c"
Go to the source code of this file.
Macros | |
#define | Y_TRANS_STATUS_NONE 0 |
Transaction status tracking. More... | |
#define | Y_TRANS_STATUS_STARTED 1 |
Transaction status tracking. More... | |
#define | Y_TRANS_STATUS_AUTO_STARTED 2 |
Transaction status tracking. More... | |
#define | y_set_transaction_nr 0y_set_transaction_nr_no_longer_exists_please_use_y_set_next_transaction_nr |
#define | y_get_transaction_nr 0y_get_transaction_nr_no_longer_exists_please_use_y_get_next_transaction_nr |
#define | y_get_and_increment_transaction_nr 0y_get_and_increment_transaction_nr_no_longer_exists_please_use_y_increment_transaction_nr |
#define | y_get_sub_transaction_nr 0y_get_sub_transaction_nr_no_longer_exists_please_use_y_get_next_sub_transaction_nr |
#define | y_get_and_increment_sub_transaction_nr 0y_get_and_increment_sub_transaction_nr_no_longer_exists_please_use_y_increment_sub_transaction_nr |
#define | y_set_sub_transaction_nr 0y_set_sub_transaction_nr_no_longer_exists_please_use_y_set_next_sub_transaction_nr |
#define | Y_NO_PAUSE 0 |
#define | Y_FORCE_PAUSE 1 |
#define | Y_TRANS_WEB_LINK(TRANSACTION, LINKNAME) |
Typedefs | |
typedef int( | y_trigger_func) () |
Transaction trigger support typedef. More... | |
typedef int( | y_trans_start_impl_func) (char *trans_name) |
typedef int( | y_trans_end_impl_func) (char *trans_name, int status) |
Variables | |
int | _y_add_group_to_trans = 0 |
INTERNAL: Whether to add the name of the vuser group to the transaction names. 1 = on, 0 = off. More... | |
int | _y_wasted_time_graph = 0 |
INTERNAL: Whether to create a graph detailing wasted time. Debugging option. More... | |
int | _y_transaction_nr = 1 |
INTERNAL: Transaction counting for transaction blocks: More... | |
int | _y_sub_transaction_nr = 1 |
INTERNAL: Transaction counting for sub transactions: More... | |
int | y_session_transaction_count = -1 |
Transaction counting support for sessions. More... | |
int | _y_trans_status = Y_TRANS_STATUS_NONE |
INTERNAL: Transaction status tracking. More... | |
y_trigger_func * | _y_trigger_start_trans = NULL |
y_trigger_func * | _y_trigger_end_trans = NULL |
y_trigger_func * | _y_trigger_start_sub_trans = NULL |
y_trigger_func * | _y_trigger_end_sub_trans = NULL |
y_trans_start_impl_func * | _y_trans_start_impl = &lr_start_transaction |
Start transaction implementation pointer. Default lr_start_transaction(). More... | |
y_trans_end_impl_func * | _y_trans_end_impl = &lr_end_transaction |
End transaction implementation pointer. Default lr_end_transaction(). More... | |
merc_timer_handle_t | y_session_timer = NULL |
Session timer variable for session timer support. More... | |
ylib transaction library.
Allows you to extend your script with the following features:
Include this file (or y_lib.c) in your script, call y_start_transaction() and y_end_transaction() everywhere you normally call the loadrunner variants. Use search-and-replace to convert existing scripts. Add calls to y_start_transaction_block() and y_end_transaction_block() to set a transaction prefix.
Y-lib transaction names take the form: '{transaction_prefix}_{transaction_nr}_{step_name}'. Sub transaction names take the form: '{transaction_prefix}_{transaction_nr}_{sub_transaction_nr}_{step_name}'. Calling y_start_transaction_block() starts a block of transactions that all use the name of the block as the transaction prefix.
Optionally the vuser group name can be added to the transaction names as well. This allows differentiation between different types of users that are all running the same script otherwise.
A trigger is a function that will execute every time an ylib transaction starts or stops. You can define seperate triggers for transaction start, stop, and the sub transaction start and stop. The return value of the trigger is used to determine whether the transaction should pass or fail, in the case of end transaction triggers.
Ylib can be configured to run your own custom transaction start/stop implementation instead of the usual loadrunner functions whenever a transaction starts or stops. This can be used for a variety of things; For example, calculating the 99th percentile responstime for a specific group of transactions can be done by starting a seperate transaction on top of the normal one for the transactions in question. A different example would be having all transactions log a timestamp with the transaction name whenever a transaction starts or stops.
Definition in file y_transaction.c.
#define Y_FORCE_PAUSE 1 |
Definition at line 909 of file y_transaction.c.
#define y_get_and_increment_sub_transaction_nr 0y_get_and_increment_sub_transaction_nr_no_longer_exists_please_use_y_increment_sub_transaction_nr |
Definition at line 336 of file y_transaction.c.
#define y_get_and_increment_transaction_nr 0y_get_and_increment_transaction_nr_no_longer_exists_please_use_y_increment_transaction_nr |
Definition at line 334 of file y_transaction.c.
#define y_get_sub_transaction_nr 0y_get_sub_transaction_nr_no_longer_exists_please_use_y_get_next_sub_transaction_nr |
Definition at line 335 of file y_transaction.c.
#define y_get_transaction_nr 0y_get_transaction_nr_no_longer_exists_please_use_y_get_next_transaction_nr |
Definition at line 333 of file y_transaction.c.
#define Y_NO_PAUSE 0 |
Definition at line 908 of file y_transaction.c.
#define y_set_sub_transaction_nr 0y_set_sub_transaction_nr_no_longer_exists_please_use_y_set_next_sub_transaction_nr |
Definition at line 337 of file y_transaction.c.
#define y_set_transaction_nr 0y_set_transaction_nr_no_longer_exists_please_use_y_set_next_transaction_nr |
Definition at line 332 of file y_transaction.c.
#define Y_TRANS_STATUS_AUTO_STARTED 2 |
Transaction status tracking.
Definition at line 124 of file y_transaction.c.
#define Y_TRANS_STATUS_NONE 0 |
Transaction status tracking.
Definition at line 120 of file y_transaction.c.
#define Y_TRANS_STATUS_STARTED 1 |
Transaction status tracking.
Definition at line 122 of file y_transaction.c.
#define Y_TRANS_WEB_LINK | ( | TRANSACTION, | |
LINKNAME | |||
) |
Definition at line 1000 of file y_transaction.c.
typedef int( y_trans_end_impl_func) (char *trans_name, int status) |
Definition at line 142 of file y_transaction.c.
typedef int( y_trans_start_impl_func) (char *trans_name) |
Definition at line 140 of file y_transaction.c.
typedef int( y_trigger_func) () |
Transaction trigger support typedef.
Definition at line 129 of file y_transaction.c.
void __y_do_not_call_this_is_a_workaround_that_only_exists_to_prevent_a_null_dereference_error_in_vugen_when_running | ( | ) |
Workaround for a bug in LR 11.
If you have a script that does not contain any regular loadrunner transactions but leans exclusively on ylib instead a very interesting error occurs when running. Adding calls to lr_start_transaction() and lr_end_transaction() that are never actually used is enough to stop that from occurring. Alternatively, the "y_start_trans_impl_func" and "y_end_trans_impl_func" pointers could be initialized to NULL. But that would stop y_start/y_end_transaction() from actually recording transactions.. so we're not going to do that. :)
Definition at line 159 of file y_transaction.c.
char* y_calculate_actual_transaction_prefix | ( | const char * | transaction_prefix | ) |
Transaction name factory helper.
Add together the transaction prefix, vuser group name (if applicable), and transaction number, seperated by "_", and return the result in a newly allocated piece of memory on the heap. Automatically called by y_start_transaction() and friends as needed.
[in] | transaction_prefix | The current transaction prefix as given to y_start_transaction_block() |
Definition at line 608 of file y_transaction.c.
void y_create_new_sub_transaction_name | ( | const char * | transaction_name, |
const char * | transaction_prefix, | ||
const int | transaction_nr, | ||
const int | sub_transaction_nr | ||
) |
Definition at line 698 of file y_transaction.c.
void y_create_new_transaction_name | ( | const char * | transaction_name, |
const char * | transaction_prefix, | ||
int | transaction_nr | ||
) |
Definition at line 668 of file y_transaction.c.
void y_create_next_sub_transaction_name | ( | const char * | transaction_name | ) |
Definition at line 720 of file y_transaction.c.
void y_create_next_transaction_name | ( | const char * | transaction_name | ) |
Definition at line 688 of file y_transaction.c.
void y_end_action_block | ( | ) |
Definition at line 584 of file y_transaction.c.
int y_end_sub_transaction | ( | char * | transaction_name, |
int | status | ||
) |
Definition at line 848 of file y_transaction.c.
int y_end_transaction | ( | char * | transaction_name, |
int | status | ||
) |
Definition at line 771 of file y_transaction.c.
void y_end_transaction_block | ( | ) |
Definition at line 537 of file y_transaction.c.
char* y_get_current_sub_transaction_name | ( | ) |
Get the most recent subtransaction name as set by y_start_sub_transaction().
Definition at line 195 of file y_transaction.c.
char* y_get_current_transaction_name | ( | ) |
Get the most recent transaction name as set by y_start_transaction().
Definition at line 173 of file y_transaction.c.
int y_get_last_transaction_status | ( | ) |
Definition at line 880 of file y_transaction.c.
int y_get_next_sub_transaction_nr | ( | ) |
Definition at line 308 of file y_transaction.c.
int y_get_next_transaction_nr | ( | ) |
Get the transaction number used for the next transaction started by y_start_transaction()
Useful for complicated flows where a little bit of handcrafted helper code is needed to keep the count correct.
Definition at line 272 of file y_transaction.c.
y_trans_end_impl_func* y_get_transaction_end_implementation | ( | ) |
Definition at line 423 of file y_transaction.c.
char* y_get_transaction_prefix | ( | ) |
Get the currently used transaction prefix.
In some cases you may wish to make decisions based on what kind of clickflow is currently executing. The transaction prefix may provide exactly what you need to determine that, if you use different transaction blocks for different clickflows.
Definition at line 253 of file y_transaction.c.
int y_get_transaction_running | ( | ) |
Definition at line 340 of file y_transaction.c.
y_trans_start_impl_func* y_get_transaction_start_implementation | ( | ) |
Definition at line 418 of file y_transaction.c.
int y_increment_sub_transaction_nr | ( | ) |
Definition at line 319 of file y_transaction.c.
int y_increment_transaction_nr | ( | ) |
Increment the transaction number used by the transaction naming code.
Used internally.
Definition at line 296 of file y_transaction.c.
void y_pause_transaction_block | ( | ) |
Definition at line 544 of file y_transaction.c.
int y_post_increment_sub_transaction_nr | ( | ) |
Definition at line 314 of file y_transaction.c.
int y_post_increment_transaction_nr | ( | ) |
Increment the transaction number used by the transaction naming code.
Definition at line 284 of file y_transaction.c.
void y_resume_transaction_block | ( | char * | transaction_prefix | ) |
Definition at line 557 of file y_transaction.c.
int y_run_sub_transaction_end_trigger | ( | ) |
Definition at line 460 of file y_transaction.c.
int y_run_sub_transaction_start_trigger | ( | ) |
Definition at line 451 of file y_transaction.c.
int y_run_transaction_end_trigger | ( | ) |
Definition at line 442 of file y_transaction.c.
int y_run_transaction_start_trigger | ( | ) |
Definition at line 433 of file y_transaction.c.
void y_save_transaction_end_status | ( | char * | transaction_name, |
const char * | saveparam, | ||
int | status | ||
) |
Definition at line 473 of file y_transaction.c.
void y_session_timer_end | ( | int | required_session_duration, |
int | force_pause | ||
) |
Definition at line 912 of file y_transaction.c.
void y_session_timer_start | ( | char * | session_name | ) |
Definition at line 899 of file y_transaction.c.
int y_session_transaction_count_increment | ( | ) |
Definition at line 503 of file y_transaction.c.
void y_session_transaction_count_report | ( | char * | session_name | ) |
Definition at line 508 of file y_transaction.c.
void y_session_transaction_count_reset | ( | ) |
Definition at line 514 of file y_transaction.c.
void y_set_add_group_to_transaction | ( | int | add_group_to_trans | ) |
Toggle using the vuser group name in ylib transaction names Useful if you wish to set up two virtual user groups executing the exact same script with some kind of subtle different that makes it necessary to differentiate between the transactions from each group. Default is off.
[in] | add_group_to_trans | Value determining if the group name is added to transaction name. Set to 1 it will be added, if set to 0 it will not be. |
Definition at line 220 of file y_transaction.c.
void y_set_current_sub_transaction_name | ( | char * | trans_name | ) |
Store the name of the current subtransaction.
[in] | trans_name | The full name of the subtransaction. |
Definition at line 206 of file y_transaction.c.
void y_set_current_transaction_name | ( | char * | trans_name | ) |
Store the name of the current transaction.
[in] | trans_name | The full name of the transaction. |
Definition at line 183 of file y_transaction.c.
void y_set_next_sub_transaction_nr | ( | int | trans_nr | ) |
Definition at line 324 of file y_transaction.c.
void y_set_next_transaction_nr | ( | int | trans_nr | ) |
Definition at line 302 of file y_transaction.c.
void y_set_sub_transaction_end_trigger | ( | y_trigger_func * | trigger_function | ) |
Definition at line 394 of file y_transaction.c.
void y_set_sub_transaction_start_trigger | ( | y_trigger_func * | trigger_function | ) |
Definition at line 389 of file y_transaction.c.
void y_set_transaction_end_implementation | ( | y_trans_end_impl_func * | trans_end_func | ) |
Definition at line 413 of file y_transaction.c.
void y_set_transaction_end_trigger | ( | y_trigger_func * | trigger_function | ) |
Definition at line 384 of file y_transaction.c.
void y_set_transaction_prefix | ( | char * | transaction_prefix | ) |
Set the common transaction prefix for all subsequent transactions.
[in] | transaction_prefix | The transaction prefix to store. Used automatically by y_start_transaction_block() and friends. |
Definition at line 238 of file y_transaction.c.
void y_set_transaction_start_implementation | ( | y_trans_start_impl_func * | trans_start_func | ) |
Definition at line 408 of file y_transaction.c.
void y_set_transaction_start_trigger | ( | y_trigger_func * | trigger_function | ) |
Definition at line 379 of file y_transaction.c.
void y_setup_step_waterfall | ( | ) |
Definition at line 1051 of file y_transaction.c.
void y_start_action_block | ( | char * | transaction_prefix | ) |
Definition at line 577 of file y_transaction.c.
int y_start_sub_transaction | ( | char * | transaction_name | ) |
Definition at line 819 of file y_transaction.c.
int y_start_sub_transaction_with_number | ( | char * | transaction_name, |
int | transaction_number | ||
) |
Definition at line 840 of file y_transaction.c.
int y_start_transaction | ( | char * | transaction_name | ) |
Definition at line 737 of file y_transaction.c.
void y_start_transaction_block | ( | char * | transaction_prefix | ) |
Definition at line 525 of file y_transaction.c.
int y_start_transaction_with_number | ( | char * | transaction_name, |
int | transaction_number | ||
) |
Definition at line 761 of file y_transaction.c.
void y_trans_web_link | ( | char * | transaction, |
char * | linkname | ||
) |
Definition at line 962 of file y_transaction.c.
void y_waterfall_random_weighted_continue | ( | char * | stepname | ) |
Definition at line 1080 of file y_transaction.c.
int _y_add_group_to_trans = 0 |
INTERNAL: Whether to add the name of the vuser group to the transaction names. 1 = on, 0 = off.
Definition at line 106 of file y_transaction.c.
int _y_sub_transaction_nr = 1 |
INTERNAL: Transaction counting for sub transactions:
Definition at line 113 of file y_transaction.c.
y_trans_end_impl_func* _y_trans_end_impl = &lr_end_transaction |
End transaction implementation pointer. Default lr_end_transaction().
Definition at line 146 of file y_transaction.c.
y_trans_start_impl_func* _y_trans_start_impl = &lr_start_transaction |
Start transaction implementation pointer. Default lr_start_transaction().
Definition at line 144 of file y_transaction.c.
int _y_trans_status = Y_TRANS_STATUS_NONE |
INTERNAL: Transaction status tracking.
Definition at line 126 of file y_transaction.c.
int _y_transaction_nr = 1 |
INTERNAL: Transaction counting for transaction blocks:
Definition at line 111 of file y_transaction.c.
y_trigger_func* _y_trigger_end_sub_trans = NULL |
Definition at line 137 of file y_transaction.c.
y_trigger_func* _y_trigger_end_trans = NULL |
Definition at line 133 of file y_transaction.c.
y_trigger_func* _y_trigger_start_sub_trans = NULL |
Definition at line 135 of file y_transaction.c.
y_trigger_func* _y_trigger_start_trans = NULL |
Definition at line 131 of file y_transaction.c.
int _y_wasted_time_graph = 0 |
INTERNAL: Whether to create a graph detailing wasted time. Debugging option.
Definition at line 108 of file y_transaction.c.
merc_timer_handle_t y_session_timer = NULL |
Session timer variable for session timer support.
Definition at line 896 of file y_transaction.c.
int y_session_transaction_count = -1 |
Transaction counting support for sessions.
Definition at line 116 of file y_transaction.c.