[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7chS+91Nep8FtsJsOdTvMJ0HhkSD1_Fn70=hWPi7a1JpfQ@mail.gmail.com>
Date: Tue, 10 Jan 2023 11:08:57 -0800
From: Namhyung Kim <namhyung@...nel.org>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Yang Jihong <yangjihong1@...wei.com>,
Kan Liang <kan.liang@...ux.intel.com>,
Kim Phillips <kim.phillips@....com>,
German Gomez <german.gomez@....com>,
Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Eelco Chaudron <echaudro@...hat.com>,
Leo Yan <leo.yan@...aro.org>,
Athira Rajeev <atrajeev@...ux.vnet.ibm.com>,
Stephane Eranian <eranian@...gle.com>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 1/2] perf tools: Remove HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE
On Mon, Jan 9, 2023 at 3:38 PM Ian Rogers <irogers@...gle.com> wrote:
>
> On Mon, Jan 9, 2023 at 2:57 PM Namhyung Kim <namhyung@...nel.org> wrote:
> >
> > Hi Ian,
> >
> > On Mon, Jan 9, 2023 at 2:31 PM Ian Rogers <irogers@...gle.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
Powered by blists - more mailing lists