Y-lib
Loadrunner libraries
Macros | Functions | Variables
y_core.c File Reference

Contains core ylib support functions needed for the functioning of the library. More...

#include "vugen.h"

Go to the source code of this file.

Macros

#define RAND_MAX   32767
 RAND_MAX constant for use with rand() - 15 bits integer. More...
 
#define Y_RAND_MAX   1073741823
 Alternate RAND_MAX constant for use with y_rand. More...
 
#define vuser_init()   vuser_init() { y_setup(); return y_vuser_init(); } y_vuser_init()
 Hook to ensure that y_setup() is called at start-up. This allows many performance improvements in the library. More...
 
#define y_is_vugen_run()   y_is_vugen_run_bool
 Test if this script is running in vugen (debug mode) More...
 

Functions

void y_setup ()
 Ylib setup - determines and stores the identity of the virtual user. More...
 
long y_rand (void)
 Generate a random (integer) number between 0 and Y_RAND_MAX (30 bit maxint). More...
 
double y_drand (void)
 Generate a random number between 0 <= y_drand() < 1. This supersedes y_rand().
Equal to Math.random in Java and JavaScript, Random.NextDouble in C#, etc. Better distribution of the random numbers over the range than by using y_rand() with modulo (%) – thus no skewed results. More...
 
char * y_mem_alloc (size_t size)
 Ylib wrapper for malloc() More...
 
char * y_array_alloc (size_t length, size_t size)
 Allocates a character array and initializes all elements to zero As y_mem_alloc(), but using the 'calloc' function, rather than 'malloc()'. More...
 
char * y_strdup (char *source)
 Copy a string into a malloc'd piece of memory using strdup(), and lr_abort() if the allocation fails. See the strdup() C documentation for what it does. This is just a simple wrapper around it that catches the strdup return value and handles any errors by aborting the script. More...
 
char * y_get_parameter_eval_string (const char *param_name)
 Obtain the string required to fetch the contents of a parameter through lr_eval_string(). More...
 
int y_is_empty_parameter (const char *param_name)
 Test if the given parameter is empty or not yet set. (These are two different things..) It would be nice if loadrunner had a builtin for this. More...
 
char * y_get_parameter (const char *param_name)
 Get the content of a parameter and return it as a char *. More...
 
char * y_get_parameter_or_null (const char *param_name)
 Get the content of a parameter and return it as a char *, or return NULL if it wasn't set. More...
 
char * y_get_parameter_with_malloc_or_null (const char *src_param)
 Get the content of a parameter and return it as a char * (malloc version) More...
 
char * y_get_parameter_ext (const char *source_param)
 Get the content of a parameter and return it as a char * (lr_eval_string_ext() version) More...
 

Variables

int y_virtual_user_id = 0
 The virtual user id, as reported by lr_whoami(). More...
 
char * y_virtual_user_group = NULL
 The virtual user group, as reported by lr_whoami(). More...
 
int y_scid
 The virtual user scid, as reported by lr_whoami(). More...
 
int y_is_vugen_run_bool = 0
 Boolean, true when running in Vugen. Not able to do this in pre-compile phase. More...
 

Detailed Description

Contains core ylib support functions needed for the functioning of the library.

This file contains two types of functions: 1) Functions that are needed to make the rest of y_lib work properly. 2) Functions that are deemed important enough that almost all scripts are expected to use them to some extend or other.

Definition in file y_core.c.