I am looking for a code which can generate V4 UUID using UTC Timestamp as input.
I want use this code in my Load Runner script to pass UUID in my Load Runner request.
Appreciate if the code is provided in C++
I am looking for a code which can generate V4 UUID using UTC Timestamp as input.
I want use this code in my Load Runner script to pass UUID in my Load Runner request.
Appreciate if the code is provided in C++
I recall using something like
int GenerateGuid()
{
typedef struct _GUID
{
unsigned long Group1;
unsigned short Group2;
unsigned short Group3;
unsigned char Group4[8];
} GUID;
GUID m_guid;
char msgId[msgIdSize];
lr_load_dll("ole32.dll");
CoCreateGuid(&m_guid);
sprintf(msgId, "%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
m_guid.Group1, m_guid.Group2, m_guid.Group3,
m_guid.Group4[0], m_guid.Group4[1], m_guid.Group4[2], m_guid.Group4[3],
m_guid.Group4[4], m_guid.Group4[5], m_guid.Group4[6], m_guid.Group4[7]);
lr_save_string(msgId, "msgId");
return 0;
}
This is basically call of CoCreateuid function (will apply to Windows load generators only) and storing the result into msgid
LoadRunner Parameter.
Actually it was the last time I used LoadRunner as as far as I remember it failed to produce required amount of large POST requests on the hardware (and I also had to work around several artificial limitations on request size) while Apache JMeter worked as a charm. Just to compare, you need just call a single function like: ${__UUID}
and that's it. Check out Writing Your First JMeter Script article if interested.
LoadRunner is a C virtual User, not C++
I refer you to the built-in functions web_save_timestamp_param() or lr_save_timestamp() as options for your use
I am using the below code to generate UUID in loadrunner independent of the OS of the Loadgenerators. Please check this link as well - How to generate Universally Unique IDentifier, UUID from LoadRunner independent of the OS
int lr_guid_gen()
{
char GUID[40];
int t = 0;
char *szTemp = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";
char *szHex = "0123456789abcdef-";
int nLen = strlen (szTemp);
for (t=0; t<nLen+1; t++)
{
int r = rand () % 16;
char c = ' ';
switch (szTemp[t])
{
case 'x' : { c = szHex [r]; } break;
case 'y' : { c = szHex [r & 0x03 | 0x08]; } break;
case '-' : { c = '-'; } break;
case '4' : { c = '4'; } break;
}
GUID[t] = ( t < nLen ) ? c : 0x00;
}
lr_save_string(GUID,"PAR_GUID");
return 0;
}