mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-01 06:46:35 +01:00
perf tools: Check if libtracevent has TEP_FIELD_IS_RELATIVE
Some distros have older versions of libtraceevent where TEP_FIELD_IS_RELATIVE and its associated semantics are not present, so we need to check if the version has it, it was introduced in libtraceevent 1.5.0. Reported-by: Athira Jajeev <[email protected]> Tested-by: Athira Jajeev <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Peter Zijlstra <[email protected]>, Cc: Stephane Eranian <[email protected]> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
1 parent
4171925aa9
commit
b9a49f8cb0
8 files changed
+18
-1
No files matched your search
@@ -1197,6 +1197,10 @@ 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
|
||||
|
||||
@@ -2729,8 +2729,10 @@ 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 (field->flags & TEP_FIELD_IS_RELATIVE)
|
||||
offset += field->offset + field->size;
|
||||
#endif
|
||||
}
|
||||
|
||||
val = (uintptr_t)(sample->raw_data + offset);
|
||||
|
||||
@@ -322,8 +322,10 @@ 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 (flags & TEP_FIELD_IS_RELATIVE)
|
||||
offset += fmtf->offset + fmtf->size;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (flags & TEP_FIELD_IS_ARRAY) {
|
||||
|
||||
@@ -2784,8 +2784,10 @@ void *evsel__rawptr(struct evsel *evsel, struct perf_sample *sample, const char
|
||||
if (field->flags & TEP_FIELD_IS_DYNAMIC) {
|
||||
offset = *(int *)(sample->raw_data + field->offset);
|
||||
offset &= 0xffff;
|
||||
#ifdef HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE
|
||||
if (field->flags & TEP_FIELD_IS_RELATIVE)
|
||||
offset += field->offset + field->size;
|
||||
#endif
|
||||
}
|
||||
|
||||
return sample->raw_data + offset;
|
||||
|
||||
@@ -442,8 +442,10 @@ 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 (field->flags & TEP_FIELD_IS_RELATIVE)
|
||||
offset += field->offset + field->size;
|
||||
#endif
|
||||
}
|
||||
if (field->flags & TEP_FIELD_IS_STRING &&
|
||||
is_printable_array(data + offset, len)) {
|
||||
|
||||
@@ -393,8 +393,10 @@ 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 (field->flags & TEP_FIELD_IS_RELATIVE)
|
||||
offset += field->offset + field->size;
|
||||
#endif
|
||||
} else
|
||||
offset = field->offset;
|
||||
XPUSHs(sv_2mortal(newSVpv((char *)data + offset, 0)));
|
||||
|
||||
@@ -994,8 +994,10 @@ static void python_process_tracepoint(struct perf_sample *sample,
|
||||
offset = val;
|
||||
len = offset >> 16;
|
||||
offset &= 0xffff;
|
||||
#ifdef HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE
|
||||
if (field->flags & TEP_FIELD_IS_RELATIVE)
|
||||
offset += field->offset + field->size;
|
||||
#endif
|
||||
}
|
||||
if (field->flags & TEP_FIELD_IS_STRING &&
|
||||
is_printable_array(data + offset, len)) {
|
||||
|
||||
@@ -2568,9 +2568,10 @@ 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 (field->flags & TEP_FIELD_IS_RELATIVE)
|
||||
offset += field->offset + field->size;
|
||||
|
||||
#endif
|
||||
/* record max width for output */
|
||||
if (size > hde->dynamic_len)
|
||||
hde->dynamic_len = size;
|
||||
|
||||
Reference in new issue
Block a user