From: Francis Deslauriers Date: Fri, 20 Mar 2020 20:23:17 +0000 (-0400) Subject: Record event as soon as one filter evaluates to TRUE X-Git-Tag: before-upstreaming~14 X-Git-Url: http://git.liburcu.org/?p=lttng-modules.git;a=commitdiff_plain;h=8904bcfacc9114c2260bb1f24d8c9db8df5ebe9e Record event as soon as one filter evaluates to TRUE This is a tiny optimization but it can reduce tracing cost in cases where multiple filters are attached to a probe. Since we want to trace an event if any of its filter expressions evaluates to TRUE, there is no need to keep on evaluating expressions once one is found to be TRUE. Signed-off-by: Francis Deslauriers Signed-off-by: Mathieu Desnoyers Change-Id: I6b5b7697869d3e25dc24d38dc39c34ae1d49dcc9 --- diff --git a/probes/lttng-tracepoint-event-impl.h b/probes/lttng-tracepoint-event-impl.h index 321cdfa4..34561243 100644 --- a/probes/lttng-tracepoint-event-impl.h +++ b/probes/lttng-tracepoint-event-impl.h @@ -1171,8 +1171,10 @@ static void __event_probe__##_name(void *__data, _proto) \ tp_locvar, _args); \ lttng_list_for_each_entry_rcu(bc_runtime, &__event->bytecode_runtime_head, node) { \ if (unlikely(bc_runtime->filter(bc_runtime, &__lttng_probe_ctx, \ - __stackvar.__filter_stack_data) & LTTNG_FILTER_RECORD_FLAG)) \ + __stackvar.__filter_stack_data) & LTTNG_FILTER_RECORD_FLAG)) { \ __filter_record = 1; \ + break; \ + } \ } \ if (likely(!__filter_record)) \ goto __post; \ @@ -1264,8 +1266,10 @@ static void __event_probe__##_name(void *__data) \ tp_locvar); \ lttng_list_for_each_entry_rcu(bc_runtime, &__event->bytecode_runtime_head, node) { \ if (unlikely(bc_runtime->filter(bc_runtime, &__lttng_probe_ctx, \ - __stackvar.__filter_stack_data) & LTTNG_FILTER_RECORD_FLAG)) \ + __stackvar.__filter_stack_data) & LTTNG_FILTER_RECORD_FLAG)) { \ __filter_record = 1; \ + break; \ + } \ } \ if (likely(!__filter_record)) \ goto __post; \