Skip to contentSkip to conversation

perf trace: Check and discard not only 'nr' but also '__syscall_nr'

PATCH New Taeung Song 2 participants 2 messages Feb 26, 2016 – Mar 5, 2016 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 perf trace: Check and discard not only 'nr' but also '__syscall_nr'

Format fields of a syscall have the first variable '__syscall_nr' or 'nr' that mean the syscall number. But it isn't relevant here so drop it.

'nr' among fields of syscall was renamed '__syscall_nr'. So add exception handling to drop '__syscall_nr' and modify the comment for this excpetion handling.

Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Steven Rostedt <[email protected]>
---
 tools/perf/builtin-trace.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tools/perf/builtin-trace.c +6 -2
index 20916dd..a252f3a 100644
@@ -1724,8 +1724,12 @@ static int trace__read_syscall_info(struct trace *trace, int id)
 
 	sc->args = sc->tp_format->format.fields;
 	sc->nr_args = sc->tp_format->format.nr_fields;
-	/* drop nr field - not relevant here; does not exist on older kernels */
-	if (sc->args && strcmp(sc->args->name, "nr") == 0) {
+	/*
+	 * We need to check and discard the first variable '__syscall_nr'
+	 * or 'nr' that mean the syscall number. It is needless here.
+	 * So drop '__syscall_nr' or 'nr' field but does not exist on older kernels.
+	 */
+	if (sc->args && (!strcmp(sc->args->name, "__syscall_nr") || !strcmp(sc->args->name, "nr"))) {
 		sc->args = sc->args->next;
 		--sc->nr_args;
 	}
Signature · 1 line
2.5.0
#1 lore raw
perf trace: Check and discard not only 'nr' but also '__syscall_nr'
Commit-ID:  c42de706dad3f39c1f65e473a1d165ea33f8b6e8
Gitweb:     http://git.kernel.org/tip/c42de706dad3f39c1f65e473a1d165ea33f8b6e8
Author:     Taeung Song <[email protected]>
AuthorDate: Fri, 26 Feb 2016 22:14:25 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 29 Feb 2016 11:34:28 -0300

perf trace: Check and discard not only 'nr' but also '__syscall_nr'

Format fields of a syscall have the first variable '__syscall_nr' or 'nr' that mean the syscall number. But it isn't relevant here so drop it.

'nr' among fields of syscall was renamed '__syscall_nr'. So add exception handling to drop '__syscall_nr' and modify the comment for this excpetion handling.

---
 tools/perf/builtin-trace.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tools/perf/builtin-trace.c +6 -2
index 26a337f..8dc98c5 100644
@@ -1725,8 +1725,12 @@ static int trace__read_syscall_info(struct trace *trace, int id)
 
 	sc->args = sc->tp_format->format.fields;
 	sc->nr_args = sc->tp_format->format.nr_fields;
-	/* drop nr field - not relevant here; does not exist on older kernels */
-	if (sc->args && strcmp(sc->args->name, "nr") == 0) {
+	/*
+	 * We need to check and discard the first variable '__syscall_nr'
+	 * or 'nr' that mean the syscall number. It is needless here.
+	 * So drop '__syscall_nr' or 'nr' field but does not exist on older kernels.
+	 */
+	if (sc->args && (!strcmp(sc->args->name, "__syscall_nr") || !strcmp(sc->args->name, "nr"))) {
 		sc->args = sc->args->next;
 		--sc->nr_args;
 	}