Messages in this thread | | | From | Ian Rogers <> | Date | Tue, 10 Jan 2023 11:54:58 -0800 | Subject | Re: [PATCH v1 1/2] perf tools: Remove HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE |
| |
On Tue, Jan 10, 2023 at 11:09 AM Namhyung Kim <namhyung@kernel.org> wrote: > > On Mon, Jan 9, 2023 at 3:38 PM Ian Rogers <irogers@google.com> wrote: > > > > On Mon, Jan 9, 2023 at 2:57 PM Namhyung Kim <namhyung@kernel.org> wrote: > > > > > > Hi Ian, > > > > > > On Mon, Jan 9, 2023 at 2:31 PM Ian Rogers <irogers@google.com> wrote: > > > > diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c > > > > index e188f74698dd..cfcc253239f0 100644 > > > > --- a/tools/perf/util/sort.c > > > > +++ b/tools/perf/util/sort.c > > > > @@ -28,6 +28,7 @@ > > > > #include "time-utils.h" > > > > #include "cgroup.h" > > > > #include "machine.h" > > > > +#include "trace-event.h" > > > > #include <linux/kernel.h> > > > > #include <linux/string.h> > > > > > > > > @@ -2667,7 +2668,7 @@ static int64_t __sort__hde_cmp(struct perf_hpp_fmt *fmt, > > > > tep_read_number_field(field, a->raw_data, &dyn); > > > > offset = dyn & 0xffff; > > > > size = (dyn >> 16) & 0xffff; > > > > -#ifdef HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE > > > > +#if LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0) > > > > if (field->flags & TEP_FIELD_IS_RELATIVE) > > > > offset += field->offset + field->size; > > > > > > Maybe I missed the previous discussion. > > > > > > As it's only used in the bit test, can we have something like this > > > in the header file? > > > > > > #if LIBTRACE_EVENT_VERSION < ...(1, 5, 0) > > > # define TEP_FIELD_IS_RELATIVE 0 > > > #endif > > > > > > Thanks, > > > Namhyung > > > > We could but I think we lose some of the intention revealing-ness that > > TEP_FIELD_IS_RELATIVE is only present with libtraceevent 1.5.0 or > > newer. > > I'm not sure how important it is to reveal the intention. > I think we wanted to minimize #ifdef-ery in the .c file and > moved the conditionals to the header. Maybe we can add > a wrapper like this. > > #if LIBTRACEEVENT_VERSION >= ...(1, 5, 0) > static inline bool is_relative_field(field) > { > return field->flags & TEP_FIELD_IS_RELATIVE; > } > #else > static inline bool is_relative_field(field) > { > return false; > } > #endif > > Thanks, > Namhyung
Sounds good. Should the change be part of this one or a follow up patch? A follow up patch seems cleanest, I can add it to v2.
Thanks, Ian
| |