Skip to contentSkip to conversation

perf trace: Order -e syscalls table

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Jul 30, 2019 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  83e69b92b10c2a8b75e1919b7074338f8bdbacaf
Gitweb:     https://git.kernel.org/tip/83e69b92b10c2a8b75e1919b7074338f8bdbacaf
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Mon, 15 Jul 2019 17:28:25 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 29 Jul 2019 18:34:41 -0300

perf trace: Order -e syscalls table

The ev_qualifier is an array with the syscall ids passed via -e on the command line, sort it as we'll search it when setting up the BPF_MAP_TYPE_PROG_ARRAY.

---
 tools/perf/builtin-trace.c | 8 ++++++++
 1 file changed, 8 insertions(+)
tools/perf/builtin-trace.c +8 -0
index bfd739a321d1..9bd5ecd6a8dd 100644
@@ -1528,6 +1528,13 @@ static int trace__read_syscall_info(struct trace *trace, int id)
 	return syscall__set_arg_fmts(sc);
 }
 
+static int intcmp(const void *a, const void *b)
+{
+	const int *one = a, *another = b;
+
+	return *one - *another;
+}
+
 static int trace__validate_ev_qualifier(struct trace *trace)
 {
 	int err = 0;
@@ -1591,6 +1598,7 @@ matches:
 	}
 
 	trace->ev_qualifier_ids.nr = nr_used;
+	qsort(trace->ev_qualifier_ids.entries, nr_used, sizeof(int), intcmp);
 out:
 	if (printed_invalid_prefix)
 		pr_debug("\n");