diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 8c837c8a6c8c..f5eb1af8302c 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -8,6 +8,7 @@ #include #include #include "term.h" +#include "env.h" #include "evlist.h" #include "evsel.h" #include @@ -673,7 +674,22 @@ static int add_tracepoint_multi_sys(struct parse_events_state *parse_state, size_t default_breakpoint_len(void) { +#if defined(__i386__) + static int len; + + if (len == 0) { + struct perf_env env = {}; + + perf_env__init(&env); + len = perf_env__kernel_is_64_bit(&env) ? sizeof(u64) : sizeof(long); + perf_env__exit(&env); + } + return len; +#elif defined(__aarch64__) + return 4; +#else return sizeof(long); +#endif } static int