From 1634bad32074e00e0ec29e0aef53210ed20f0ec5 Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Tue, 10 Jan 2023 23:06:40 -0800 Subject: perf trace: Reduce #ifdefs for TEP_FIELD_IS_RELATIVE Add a helper function that applies the mask to test, or returns false if libtraceevent is too old or not present. Signed-off-by: Ian Rogers Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Athira Jajeev Cc: Eelco Chaudron Cc: German Gomez Cc: Ingo Molnar Cc: Jiri Olsa Cc: Kan Liang Cc: Kim Phillips Cc: Leo Yan Cc: Mark Rutland Cc: Namhyung Kim Cc: Paolo Bonzini Cc: Peter Zijlstra Cc: Sean Christopherson Cc: Stephane Eranian Cc: Yang Jihong Link: https://lore.kernel.org/r/20230111070641.1728726-2-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-trace.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'tools/perf/builtin-trace.c') diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 46944eaba2e5..610fb60b1c0d 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -2731,10 +2731,8 @@ static size_t trace__fprintf_tp_fields(struct trace *trace, struct evsel *evsel, offset = format_field__intval(field, sample, evsel->needs_swap); syscall_arg.len = offset >> 16; offset &= 0xffff; -#if LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0) - if (field->flags & TEP_FIELD_IS_RELATIVE) + if (tep_field_is_relative(field->flags)) offset += field->offset + field->size; -#endif } val = (uintptr_t)(sample->raw_data + offset); -- cgit v1.2.3