perf tools: Remove HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE
Ian Rogers
reviewerPATCH 1/2 perf tools: Remove HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE
Switch HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE to be a version number test on libtraceevent being >= to version 1.5.0. This also corrects a greater-than test to be greater-than-or-equal.
Discussed here:
https://lore.kernel.org/lkml/[email protected]/
--- tools/perf/Makefile.config | 4 ---- tools/perf/builtin-trace.c | 2 +- tools/perf/util/data-convert-bt.c | 2 +- tools/perf/util/evsel.c | 2 +- tools/perf/util/python.c | 2 +- tools/perf/util/scripting-engines/trace-event-perl.c | 2 +- tools/perf/util/scripting-engines/trace-event-python.c | 2 +- tools/perf/util/sort.c | 3 ++- tools/perf/util/trace-event.h | 3 +++ 9 files changed, 11 insertions(+), 11 deletions(-)
tools/perf/Makefile.config +0 -4
@@ -1204,10 +1204,6 @@ ifneq ($(NO_LIBTRACEEVENT),1) LIBTRACEEVENT_VERSION_CPP := $(shell expr $(LIBTRACEEVENT_VERSION_1) \* 255 \* 255 + $(LIBTRACEEVENT_VERSION_2) \* 255 + $(LIBTRACEEVENT_VERSION_3)) CFLAGS += -DLIBTRACEEVENT_VERSION=$(LIBTRACEEVENT_VERSION_CPP) $(call detected,CONFIG_LIBTRACEEVENT) - LIBTRACEEVENT_VERSION_WITH_TEP_FIELD_IS_RELATIVE := $(shell expr 1 \* 255 \* 255 + 5 \* 255 + 0) # 1.5.0 - ifeq ($(shell test $(LIBTRACEEVENT_VERSION_CPP) -gt $(LIBTRACEEVENT_VERSION_WITH_TEP_FIELD_IS_RELATIVE); echo $$?),0) - CFLAGS += -DHAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE - endif else dummy := $(warning Warning: libtraceevent is missing limiting functionality, please install libtraceevent-dev/libtraceevent-devel) endif
tools/perf/builtin-trace.c +1 -1
@@ -2729,7 +2729,7 @@ 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 ; -#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;#endif
tools/perf/util/data-convert-bt.c +1 -1
@@ -322,7 +322,7 @@ static int add_tracepoint_field_value(struct ctf_writer *cw, offset = tmp_val; len = offset >>16 ; offset &=0xffff ; -#ifdef HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE +#if LIBTRACEEVENT_VERSION >=MAKE_LIBTRACEEVENT_VERSION (1 ,5 ,0 )if (flags &TEP_FIELD_IS_RELATIVE ) offset += fmtf->offset + fmtf->size;#endif
tools/perf/util/evsel.c +1 -1
@@ -2784,7 +2784,7 @@ void *evsel__rawptr(struct evsel *evsel, struct perf_sample *sample, const charif (field->flags &TEP_FIELD_IS_DYNAMIC ) { offset = *(int *)(sample->raw_data + field->offset); offset &=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;#endif
tools/perf/util/python.c +1 -1
@@ -442,7 +442,7 @@ tracepoint_field(struct pyrf_event *pe, struct tep_format_field *field) offset = val; len = offset >>16 ; offset &=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;#endif
tools/perf/util/scripting-engines/trace-event-perl.c +1 -1
@@ -393,7 +393,7 @@ static void perl_process_tracepoint(struct perf_sample *sample,if (field->flags &TEP_FIELD_IS_DYNAMIC ) { offset = *(int *)(data + field->offset); offset &=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;#endif
tools/perf/util/scripting-engines/trace-event-python.c +1 -1
@@ -994,7 +994,7 @@ static void python_process_tracepoint(struct perf_sample *sample, offset = val; len = offset >>16 ; offset &=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;#endif
tools/perf/util/sort.c +2 -1
@@ -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;#endif
tools/perf/util/trace-event.h +3 -0
@@ -20,6 +20,9 @@ struct trace_event {struct tep_plugin_list *plugin_list; }; +/* Computes a version number comparable with LIBTRACEEVENT_VERSION from Makefile.config. */ +#define MAKE_LIBTRACEEVENT_VERSION (a, b, c) ((a)*255*255+(b)*255+(c)) +typedef char *(tep_func_resolver_t )(void *priv,unsigned long long *addrp,char **modp);
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
Ian Rogers
reviewerPATCH 2/2 perf debug: Increase libtraceevent logging when verbose
libtraceevent has added more levels of debug printout and with changes like:
https://lore.kernel.org/linux-trace-devel/[email protected]
previously generated output like "registering plugin" is no longer displayed. This change makes it so that if perf's verbose debug output is enabled then the debug and info libtraceevent messages can be displayed.
This change was previously posted:
https://lore.kernel.org/linux-perf-users/[email protected]/
and reverted:
https://lore.kernel.org/linux-perf-users/[email protected]/
The previous failure was due to -Itools/lib being on the include path and libtraceevent in tools/lib being version 1.1.0. This meant that when LIBTRACEEVENT_VERSION was 1.3.0 the #if succeeded, but the header file for libtraceevent (taken from tools/lib rather than the intended /usr/include) was for version 1.1.0 and function definitions were missing.
Since the previous issue the -Itools/lib include path has been removed:
https://lore.kernel.org/lkml/[email protected]/
As well as libtraceevent 1.1.0 has been removed from tools/lib:
https://lore.kernel.org/lkml/[email protected]/
--- tools/perf/util/debug.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
tools/perf/util/debug.c +15 -0
@@ -19,12 +19,19 @@#include "debug.h" #include "print_binary.h" #include "target.h" +#include "trace-event.h" #include "ui/helpline.h" #include "ui/ui.h" #include "util/parse-sublevel-options.h" #include <linux/ctype.h> +#ifdef HAVE_LIBTRACEEVENT +#include <traceevent/event-parse.h> +#else +#define LIBTRACEEVENT_VERSION 0 +#endif +int verbose;int debug_peo_args;bool dump_trace = false, quiet = false;
@@ -228,6 +235,14 @@ int perf_debug_option(const char *str)/* Allow only verbose value in range (0, 10), otherwise set 0. */ verbose = (verbose <0 ) || (verbose >10 ) ?0 : verbose; +#if LIBTRACEEVENT_VERSION >=MAKE_LIBTRACEEVENT_VERSION (1 ,3 ,0 ) +if (verbose ==1 ) +tep_set_loglevel (TEP_LOG_INFO ); +else if (verbose ==2 ) +tep_set_loglevel (TEP_LOG_DEBUG ); +else if (verbose >=3 ) +tep_set_loglevel (TEP_LOG_ALL ); +#endif return 0 ; }
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
Namhyung Kim
maintainerHi Ian,
Quoted 128 lines · Ian Rogers
Switch
HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVEto be a version number test on libtraceevent being >= to version 1.5.0. This also corrects a greater-than test to be greater-than-or-equal.Discussed here:
https://lore.kernel.org/lkml/[email protected]/Fixes b9a49f8cb02f ("perf tools: Check if libtracevent has TEP_FIELD_IS_RELATIVE")Signed-off-by Ian Rogers <[email protected]>--- tools/perf/Makefile.config | 4 ---- tools/perf/builtin-trace.c | 2 +- tools/perf/util/data-convert-bt.c | 2 +- tools/perf/util/evsel.c | 2 +- tools/perf/util/python.c | 2 +- tools/perf/util/scripting-engines/trace-event-perl.c | 2 +- tools/perf/util/scripting-engines/trace-event-python.c | 2 +- tools/perf/util/sort.c | 3 ++- tools/perf/util/trace-event.h | 3 +++ 9 files changed, 11 insertions(+), 11 deletions(-)tools/perf/Makefile.config +0
-4@@ -1204,10 +1204,6 @@ ifneq ($(NO_LIBTRACEEVENT),1) LIBTRACEEVENT_VERSION_CPP := $(shell expr $(LIBTRACEEVENT_VERSION_1) \* 255 \* 255 + $(LIBTRACEEVENT_VERSION_2) \* 255 + $(LIBTRACEEVENT_VERSION_3)) CFLAGS += -DLIBTRACEEVENT_VERSION=$(LIBTRACEEVENT_VERSION_CPP) $(call detected,CONFIG_LIBTRACEEVENT) - LIBTRACEEVENT_VERSION_WITH_TEP_FIELD_IS_RELATIVE := $(shell expr 1 \* 255 \* 255 + 5 \* 255 + 0) # 1.5.0 - ifeq ($(shell test $(LIBTRACEEVENT_VERSION_CPP) -gt $(LIBTRACEEVENT_VERSION_WITH_TEP_FIELD_IS_RELATIVE); echo $$?),0) - CFLAGS += -DHAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE - endif else dummy := $(warning Warning: libtraceevent is missing limiting functionality, please install libtraceevent-dev/libtraceevent-devel) endiftools/perf/builtin-trace.c +1
-1@@ -2729,7 +2729,7 @@ 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 ; -#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;#endif tools/perf/util/data-convert-bt.c +1
-1@@ -322,7 +322,7 @@ static int add_tracepoint_field_value(struct ctf_writer *cw, offset = tmp_val; len = offset >>16 ; offset &=0xffff ; -#ifdef HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE +#if LIBTRACEEVENT_VERSION >=MAKE_LIBTRACEEVENT_VERSION (1 ,5 ,0 )if (flags &TEP_FIELD_IS_RELATIVE ) offset += fmtf->offset + fmtf->size;#endif tools/perf/util/evsel.c +1
-1@@ -2784,7 +2784,7 @@ void *evsel__rawptr(struct evsel *evsel, struct perf_sample *sample, const charif (field->flags &TEP_FIELD_IS_DYNAMIC ) { offset = *(int *)(sample->raw_data + field->offset); offset &=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;#endif tools/perf/util/python.c +1
-1@@ -442,7 +442,7 @@ tracepoint_field(struct pyrf_event *pe, struct tep_format_field *field) offset = val; len = offset >>16 ; offset &=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;#endif tools/perf/util/scripting-engines/trace-event-perl.c +1
-1@@ -393,7 +393,7 @@ static void perl_process_tracepoint(struct perf_sample *sample,if (field->flags &TEP_FIELD_IS_DYNAMIC ) { offset = *(int *)(data + field->offset); offset &=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;#endif tools/perf/util/scripting-engines/trace-event-python.c +1
-1@@ -994,7 +994,7 @@ static void python_process_tracepoint(struct perf_sample *sample, offset = val; len = offset >>16 ; offset &=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;#endif tools/perf/util/sort.c +1
-0@@ -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>
tools/perf/util/sort.c static int64_t __sort__hde_cmp(struct perf_hpp_fmt *fmt, · line 2673
Quoted 7 lines
tools/perf/util/sort.c +1
-1@@ -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
Quoted 18 lines
tools/perf/util/sort.c +0
-0#endif tools/perf/util/trace-event.h +3
-1@@ -20,6 +20,9 @@ struct trace_event {struct tep_plugin_list *plugin_list; }; +/* Computes a version number comparable with LIBTRACEEVENT_VERSION from Makefile.config. */ +#define MAKE_LIBTRACEEVENT_VERSION (a, b, c) ((a)*255*255+(b)*255+(c)) +typedef char *(tep_func_resolver_t )(void *priv,unsigned long long *addrp,char **modp); --2.39.0.314.g84b9a713c41-goog
Ian Rogers
reviewerQuoted 145 lines · Namhyung Kim
Hi Ian,
Quoted 128 lines · Ian Rogers
Switch
HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVEto be a version number test on libtraceevent being >= to version 1.5.0. This also corrects a greater-than test to be greater-than-or-equal.Discussed here:
https://lore.kernel.org/lkml/[email protected]/Fixes b9a49f8cb02f ("perf tools: Check if libtracevent has TEP_FIELD_IS_RELATIVE")Signed-off-by Ian Rogers <[email protected]>--- tools/perf/Makefile.config | 4 ---- tools/perf/builtin-trace.c | 2 +- tools/perf/util/data-convert-bt.c | 2 +- tools/perf/util/evsel.c | 2 +- tools/perf/util/python.c | 2 +- tools/perf/util/scripting-engines/trace-event-perl.c | 2 +- tools/perf/util/scripting-engines/trace-event-python.c | 2 +- tools/perf/util/sort.c | 3 ++- tools/perf/util/trace-event.h | 3 +++ 9 files changed, 11 insertions(+), 11 deletions(-)tools/perf/Makefile.config +0
-4@@ -1204,10 +1204,6 @@ ifneq ($(NO_LIBTRACEEVENT),1) LIBTRACEEVENT_VERSION_CPP := $(shell expr $(LIBTRACEEVENT_VERSION_1) \* 255 \* 255 + $(LIBTRACEEVENT_VERSION_2) \* 255 + $(LIBTRACEEVENT_VERSION_3)) CFLAGS += -DLIBTRACEEVENT_VERSION=$(LIBTRACEEVENT_VERSION_CPP) $(call detected,CONFIG_LIBTRACEEVENT) - LIBTRACEEVENT_VERSION_WITH_TEP_FIELD_IS_RELATIVE := $(shell expr 1 \* 255 \* 255 + 5 \* 255 + 0) # 1.5.0 - ifeq ($(shell test $(LIBTRACEEVENT_VERSION_CPP) -gt $(LIBTRACEEVENT_VERSION_WITH_TEP_FIELD_IS_RELATIVE); echo $$?),0) - CFLAGS += -DHAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE - endif else dummy := $(warning Warning: libtraceevent is missing limiting functionality, please install libtraceevent-dev/libtraceevent-devel) endiftools/perf/builtin-trace.c +1
-1@@ -2729,7 +2729,7 @@ 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 ; -#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;#endif tools/perf/util/data-convert-bt.c +1
-1@@ -322,7 +322,7 @@ static int add_tracepoint_field_value(struct ctf_writer *cw, offset = tmp_val; len = offset >>16 ; offset &=0xffff ; -#ifdef HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE +#if LIBTRACEEVENT_VERSION >=MAKE_LIBTRACEEVENT_VERSION (1 ,5 ,0 )if (flags &TEP_FIELD_IS_RELATIVE ) offset += fmtf->offset + fmtf->size;#endif tools/perf/util/evsel.c +1
-1@@ -2784,7 +2784,7 @@ void *evsel__rawptr(struct evsel *evsel, struct perf_sample *sample, const charif (field->flags &TEP_FIELD_IS_DYNAMIC ) { offset = *(int *)(sample->raw_data + field->offset); offset &=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;#endif tools/perf/util/python.c +1
-1@@ -442,7 +442,7 @@ tracepoint_field(struct pyrf_event *pe, struct tep_format_field *field) offset = val; len = offset >>16 ; offset &=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;#endif tools/perf/util/scripting-engines/trace-event-perl.c +1
-1@@ -393,7 +393,7 @@ static void perl_process_tracepoint(struct perf_sample *sample,if (field->flags &TEP_FIELD_IS_DYNAMIC ) { offset = *(int *)(data + field->offset); offset &=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;#endif tools/perf/util/scripting-engines/trace-event-python.c +1
-1@@ -994,7 +994,7 @@ static void python_process_tracepoint(struct perf_sample *sample, offset = val; len = offset >>16 ; offset &=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;#endif tools/perf/util/sort.c +1
-0@@ -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> tools/perf/util/sort.c static int64_t __sort__hde_cmp(struct perf_hpp_fmt *fmt, · line 2673
Quoted 7 lines
tools/perf/util/sort.c +1
-1@@ -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?
Quoted 6 lines
#if
LIBTRACE_EVENT_VERSION< ...(1, 5, 0)# define TEP_FIELD_IS_RELATIVE 0 #endifThanks,
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.
Thanks,
Ian
Quoted 18 lines
Quoted 18 lines
tools/perf/util/sort.c +0
-0#endif tools/perf/util/trace-event.h +3
-1@@ -20,6 +20,9 @@ struct trace_event {struct tep_plugin_list *plugin_list; }; +/* Computes a version number comparable with LIBTRACEEVENT_VERSION from Makefile.config. */ +#define MAKE_LIBTRACEEVENT_VERSION (a, b, c) ((a)*255*255+(b)*255+(c)) +typedef char *(tep_func_resolver_t )(void *priv,unsigned long long *addrp,char **modp); --2.39.0.314.g84b9a713c41-goog
Namhyung Kim
maintainerQuoted 36 lines · Ian Rogers
Quoted 34 lines · Namhyung Kim
Hi Ian,
Quoted 13 lines · Ian Rogers
tools/perf/util/sort.c +1
-0@@ -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> tools/perf/util/sort.c static int64_t __sort__hde_cmp(struct perf_hpp_fmt *fmt, · line 2673
Quoted 7 lines
tools/perf/util/sort.c +1
-1@@ -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
Quoted 6 lines
Quoted 2 lines
Thanks,
NamhyungWe could but I think we lose some of the intention revealing-ness that
TEP_FIELD_IS_RELATIVEis 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
Ian Rogers
reviewerQuoted 60 lines · Namhyung Kim
Quoted 36 lines · Ian Rogers
Quoted 34 lines · Namhyung Kim
Hi Ian,
Quoted 13 lines · Ian Rogers
tools/perf/util/sort.c +1
-0@@ -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> tools/perf/util/sort.c static int64_t __sort__hde_cmp(struct perf_hpp_fmt *fmt, · line 2673
Quoted 7 lines
tools/perf/util/sort.c +1
-1@@ -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 #endifQuoted 6 lines
Quoted 2 lines
Thanks,
NamhyungWe could but I think we lose some of the intention revealing-ness that
TEP_FIELD_IS_RELATIVEis 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 boolis_relative_field(field){ return field->flags & TEP_FIELD_IS_RELATIVE; } #else static inline bool is_relative_field(field) { return false; }
Quoted 4 lines
#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
Namhyung Kim
maintainerQuoted 64 lines · Ian Rogers
Quoted 62 lines · Namhyung Kim
Quoted 36 lines · Ian Rogers
Quoted 34 lines · Namhyung Kim
Hi Ian,
Quoted 13 lines · Ian Rogers
tools/perf/util/sort.c +1
-0@@ -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> tools/perf/util/sort.c static int64_t __sort__hde_cmp(struct perf_hpp_fmt *fmt, · line 2673
Quoted 7 lines
tools/perf/util/sort.c +1
-1@@ -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 #endifQuoted 6 lines
Quoted 2 lines
Thanks,
NamhyungWe could but I think we lose some of the intention revealing-ness that
TEP_FIELD_IS_RELATIVEis 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 boolis_relative_field(field){ return field->flags & TEP_FIELD_IS_RELATIVE; } #else static inline bool is_relative_field(field) { return false; }#endif
Quoted 5 lines
Quoted 2 lines
Thanks,
NamhyungSounds 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.
Sounds good.
Thanks,
Namhyung