It must only be used for debugging purpose. The exact format is not
documented because it may evolve depending on developers requirements.
+tgroup : integer
+ Returns an integer value corresponding to the position of the thread group
+ calling the function, between 0 and (global.thread-groups - 1). This is
+ useful for logging and debugging purposes.
+
thread : integer
Returns an integer value corresponding to the position of the thread calling
the function, between 0 and (global.nbthread-1). This is useful for logging
return 1;
}
+/* returns the number of the current thread group (between 0 and nbtgroups-1) */
+static int
+smp_fetch_tgroup(const struct arg *args, struct sample *smp, const char *kw, void *private)
+{
+ smp->data.type = SMP_T_SINT;
+ smp->data.u.sint = tgid - 1; // tgid starts at 1
+ return 1;
+}
+
/* generate a random 32-bit integer for whatever purpose, with an optional
* range specified in argument.
*/
{ "proc", smp_fetch_proc, 0, NULL, SMP_T_SINT, SMP_USE_CONST },
{ "quic_enabled", smp_fetch_quic_enabled, 0, NULL, SMP_T_BOOL, SMP_USE_CONST },
{ "thread", smp_fetch_thread, 0, NULL, SMP_T_SINT, SMP_USE_CONST },
+ { "tgroup", smp_fetch_tgroup, 0, NULL, SMP_T_SINT, SMP_USE_CONST },
{ "rand", smp_fetch_rand, ARG1(0,SINT), NULL, SMP_T_SINT, SMP_USE_CONST },
{ "stopping", smp_fetch_stopping, 0, NULL, SMP_T_BOOL, SMP_USE_INTRN },
{ "uptime", smp_fetch_uptime, 0, NULL, SMP_T_SINT, SMP_USE_CONST },