[lttng-dev] Any particular reason that the LTTNG_UST_TRACEPOINT_EVENT args and fields are limited to max 10?

Kienan Stewart kstewart at efficios.com
Tue Nov 28 10:20:17 EST 2023


Hi Yonghong,

My understanding is that the limit of 10 trac epoint arguments was 
initially chosen because it matched with the argumente limit in SDT 
probe points and there is optional integration between LTTng trace 
points and SDT. More recent versions of SDT, as of 1.7+, support up to 
12 arguments for probe points.

Beyond that, there may be standards/compiler-specific limits for the 
number of parameters to macros and/or function calls, but I don't think 
we're close to hitting any of those.

Note that the LTTNG_UST_TRACEPOINT_FIELDS macro doesn't share the same 
10 field limit.

Therefore, one work-around that is possible to to pack the values into a 
custom structure to reduce the number of arguments that need to be set 
in the lTTNG_UST_TRACEPOINT_ARGS macro.

eg.

```
LTTNG_UST_TRACEPOINT_EVENT(
    tp,
    many,
    LTTNG_UST_TP_ARGS(
       const struct Sample*, mystruct
    ),
    LTTNG_UST_TP_FIELDS(
       lttng_ust_field_integer(int, a, mystruct->a)
       lttng_ust_field_integer(int, b, mystruct->b)
       lttng_ust_field_integer(int, c, mystruct->c)
       lttng_ust_field_integer(int, e, mystruct->d)
       lttng_ust_field_integer(int, f, mystruct->e)
       lttng_ust_field_float(double, g, mystruct->g)
       lttng_ust_field_float(double, h, mystruct->h)
       lttng_ust_field_float(double, i, mystruct->i)
       lttng_ust_field_float(double, j, mystruct->j)
       lttng_ust_field_float(double, k, mystruct->k)
       lttng_ust_field_string(string_field, mystruct->thing)
       lttng_ust_field_string(string_field2, mystruct->thing2)
    )
)

```

Hope this helps!

thanks,
kienan

On 2023-11-27 22:26, Yonghong Yan via lttng-dev wrote:
> I have a situation where I need to record more than 10 fields. If you 
> can extend it to support more, but not introduce overhead of handling 
> such rare cases, that will be great.
> 
> Thanks
> Yonghong
> 
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


More information about the lttng-dev mailing list