57 #define RAND_MAX 32767 68 #define Y_RAND_MAX 2147483647 70 #define Y_RAND_MAX 1073741823 106 #define vuser_init() vuser_init() { y_setup(); return y_vuser_init(); } y_vuser_init() 142 #define y_is_vugen_run() y_is_vugen_run_bool 166 unsigned int randomValue;
167 rand_s(&randomValue);
193 unsigned int randomValue;
194 rand_s(&randomValue);
195 return (
double)randomValue / 4294967296.;
197 return (
rand() << 15 |
rand())/1073741824.;
227 lr_error_message(
"Insufficient memory available, requested %u bytes", size);
248 buff =
calloc(length, size);
251 lr_error_message(
"Insufficient memory available, requested %u * %u bytes", length, size);
270 char* result =
strdup(source);
273 lr_error_message(
"Out of memory while calling strdup()");
289 size_t size =
strlen(param_name) +3;
292 snprintf(result, size,
"{%s}", param_name );
308 char* param = lr_eval_string(param_eval_string);
310 int result = *param == 0 ||
strcmp(param, param_eval_string) == 0;
311 free(param_eval_string);
339 char* parameter = lr_eval_string(tmp);
376 char* param = lr_eval_string(param_eval_string);
378 int exists =
strcmp(param, param_eval_string) != 0;
380 free(param_eval_string);
383 return exists ? param: NULL;
414 #define y_get_parameter_malloc_string 0_please_use_y_get_parameter_with_malloc_or_null 446 lr_eval_string_ext(source,
strlen(source), &buffer, &size, 0, 0, -1);
void y_setup()
Ylib setup - determines and stores the identity of the virtual user.
int srand(unsigned int seed)
Documented at http://www.cplusplus.com/reference/cstdlib/srand/.
double y_drand(void)
Generate a random number between 0 <= y_drand() < 1. This supersedes y_rand(). Equal to Math...
Standard C function headers.
char * strdup(const char *string)
Documented at http://pubs.opengroup.org/onlinepubs/007904975/functions/strdup.html ...
void * malloc(size_t num_bytes)
Documented at http://www.cplusplus.com/reference/cstdlib/malloc/.
void * calloc(size_t num_elems, size_t elem_size)
Documented at http://www.cplusplus.com/reference/cstdlib/calloc/.
int y_scid
The virtual user scid, as reported by lr_whoami().
char * y_mem_alloc(size_t size)
Ylib wrapper for malloc()
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()'.
int strcmp(const char *string1, const char *string2)
Documented at http://www.cplusplus.com/reference/cstring/strcmp/.
int y_virtual_user_id
The virtual user id, as reported by lr_whoami().
#define Y_RAND_MAX
Alternate RAND_MAX constant for use with y_rand.
char * setlocale(int category, const char *locale)
Documented at http://www.cplusplus.com/reference/clocale/setlocale/.
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().
int y_is_vugen_run_bool
Boolean, true when running in Vugen. Not able to do this in pre-compile phase.
char * y_strdup(char *source)
Copy a string into a malloc'd piece of memory using strdup(), and lr_abort() if the allocation fails...
size_t strlen(const char *string)
Documented at http://www.cplusplus.com/reference/cstring/strlen/.
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.
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)
int snprintf(char *buffer, size_t n, const char *format_string,...)
Documented at http://www.cplusplus.com/reference/cstdio/snprintf/. This function was introduced by t...
long y_rand(void)
Generate a random (integer) number between 0 and Y_RAND_MAX (30 bit maxint).
char * y_virtual_user_group
The virtual user group, as reported by lr_whoami().
int rand(void)
Documented at http://www.cplusplus.com/reference/cstdlib/rand/.
char * y_get_parameter(const char *param_name)
Get the content of a parameter and return it as a char *.
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...
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) ...
time_t time(time_t *timeptr)
Documented at http://www.cplusplus.com/reference/ctime/time/.
void free(void *mem_address)
Documented at http://www.cplusplus.com/reference/cstdlib/free/.