aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/util/trace-event.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/trace-event.h')
-rw-r--r--tools/perf/util/trace-event.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h
index 9b3cd79cca12..a0cff184b1cd 100644
--- a/tools/perf/util/trace-event.h
+++ b/tools/perf/util/trace-event.h
@@ -21,6 +21,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);
@@ -137,4 +140,20 @@ int common_lock_depth(struct scripting_context *context);
#define SAMPLE_FLAGS_BUF_SIZE 64
int perf_sample__sprintf_flags(u32 flags, char *str, size_t sz);
+#if defined(LIBTRACEEVENT_VERSION) && LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0)
+#include <traceevent/event-parse.h>
+
+static inline bool tep_field_is_relative(unsigned long flags)
+{
+ return (flags & TEP_FIELD_IS_RELATIVE) != 0;
+}
+#else
+#include <linux/compiler.h>
+
+static inline bool tep_field_is_relative(unsigned long flags __maybe_unused)
+{
+ return false;
+}
+#endif
+
#endif /* _PERF_UTIL_TRACE_EVENT_H */