Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1219998

[PATCH 3/5] perf tools: Propagate error info for the tracepoint parsing

From Jiri Olsa <jolsa@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 3/5] perf tools: Propagate error info for the tracepoint parsing
Date 2015-09-07 10:40 +0200
Message-ID <q6082-ic-23@gated-at.bofh.it> (permalink)
References <q6082-ic-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Pass 'struct parse_events_error *error' to the parse-event.c
tracepoint adding path. It will be filled with error data
in following patches.

Link: http://lkml.kernel.org/n/tip-las1hm5zf58b0twd27h9895b@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/parse-events.c | 27 ++++++++++++++++-----------
 tools/perf/util/parse-events.h |  3 ++-
 tools/perf/util/parse-events.y |  4 ++--
 3 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 3840176642f8..1b284b8ad243 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -387,7 +387,8 @@ int parse_events_add_cache(struct list_head *list, int *idx,
 }
 
 static int add_tracepoint(struct list_head *list, int *idx,
-			  char *sys_name, char *evt_name)
+			  char *sys_name, char *evt_name,
+			  struct parse_events_error *error __maybe_unused)
 {
 	struct perf_evsel *evsel;
 
@@ -401,7 +402,8 @@ static int add_tracepoint(struct list_head *list, int *idx,
 }
 
 static int add_tracepoint_multi_event(struct list_head *list, int *idx,
-				      char *sys_name, char *evt_name)
+				      char *sys_name, char *evt_name,
+				      struct parse_events_error *error)
 {
 	char evt_path[MAXPATHLEN];
 	struct dirent *evt_ent;
@@ -425,7 +427,7 @@ static int add_tracepoint_multi_event(struct list_head *list, int *idx,
 		if (!strglobmatch(evt_ent->d_name, evt_name))
 			continue;
 
-		ret = add_tracepoint(list, idx, sys_name, evt_ent->d_name);
+		ret = add_tracepoint(list, idx, sys_name, evt_ent->d_name, error);
 	}
 
 	closedir(evt_dir);
@@ -433,15 +435,17 @@ static int add_tracepoint_multi_event(struct list_head *list, int *idx,
 }
 
 static int add_tracepoint_event(struct list_head *list, int *idx,
-				char *sys_name, char *evt_name)
+				char *sys_name, char *evt_name,
+				struct parse_events_error *error)
 {
 	return strpbrk(evt_name, "*?") ?
-	       add_tracepoint_multi_event(list, idx, sys_name, evt_name) :
-	       add_tracepoint(list, idx, sys_name, evt_name);
+	       add_tracepoint_multi_event(list, idx, sys_name, evt_name, error) :
+	       add_tracepoint(list, idx, sys_name, evt_name, error);
 }
 
 static int add_tracepoint_multi_sys(struct list_head *list, int *idx,
-				    char *sys_name, char *evt_name)
+				    char *sys_name, char *evt_name,
+				    struct parse_events_error *error)
 {
 	struct dirent *events_ent;
 	DIR *events_dir;
@@ -465,7 +469,7 @@ static int add_tracepoint_multi_sys(struct list_head *list, int *idx,
 			continue;
 
 		ret = add_tracepoint_event(list, idx, events_ent->d_name,
-					   evt_name);
+					   evt_name, error);
 	}
 
 	closedir(events_dir);
@@ -473,12 +477,13 @@ static int add_tracepoint_multi_sys(struct list_head *list, int *idx,
 }
 
 int parse_events_add_tracepoint(struct list_head *list, int *idx,
-				char *sys, char *event)
+				char *sys, char *event,
+				struct parse_events_error *error)
 {
 	if (strpbrk(sys, "*?"))
-		return add_tracepoint_multi_sys(list, idx, sys, event);
+		return add_tracepoint_multi_sys(list, idx, sys, event, error);
 	else
-		return add_tracepoint_event(list, idx, sys, event);
+		return add_tracepoint_event(list, idx, sys, event, error);
 }
 
 static int
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index a09b0e210997..ffee7ece75a6 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -118,7 +118,8 @@ int parse_events__modifier_event(struct list_head *list, char *str, bool add);
 int parse_events__modifier_group(struct list_head *list, char *event_mod);
 int parse_events_name(struct list_head *list, char *name);
 int parse_events_add_tracepoint(struct list_head *list, int *idx,
-				char *sys, char *event);
+				char *sys, char *event,
+				struct parse_events_error *error);
 int parse_events_add_numeric(struct parse_events_evlist *data,
 			     struct list_head *list,
 			     u32 type, u64 config,
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index 9cd70819c795..54a3004a8192 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -376,7 +376,7 @@ PE_NAME '-' PE_NAME ':' PE_NAME
 	snprintf(&sys_name, 128, "%s-%s", $1, $3);
 
 	ALLOC_LIST(list);
-	ABORT_ON(parse_events_add_tracepoint(list, &data->idx, &sys_name, $5));
+	ABORT_ON(parse_events_add_tracepoint(list, &data->idx, &sys_name, $5, data->error));
 	$$ = list;
 }
 |
@@ -386,7 +386,7 @@ PE_NAME ':' PE_NAME
 	struct list_head *list;
 
 	ALLOC_LIST(list);
-	if (parse_events_add_tracepoint(list, &data->idx, $1, $3)) {
+	if (parse_events_add_tracepoint(list, &data->idx, $1, $3, data->error)) {
 		struct parse_events_error *error = data->error;
 
 		if (error) {
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHv2 0/5] perf tools: Enhance parsing events tracepoint error output Jiri Olsa <jolsa@kernel.org> - 2015-09-07 10:40 +0200
  [PATCH 1/5] tools: Add err.h with ERR_PTR PTR_ERR interface Jiri Olsa <jolsa@kernel.org> - 2015-09-07 10:40 +0200
    Re: [PATCH 1/5] tools: Add err.h with ERR_PTR PTR_ERR interface Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-09-08 22:30 +0200
    Re: [PATCH 1/5] tools: Add err.h with ERR_PTR PTR_ERR interface Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-09-08 22:30 +0200
      Re: [PATCH 1/5] tools: Add err.h with ERR_PTR PTR_ERR interface Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-08 23:10 +0200
        Re: [PATCH 1/5] tools: Add err.h with ERR_PTR PTR_ERR interface Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-09-08 23:30 +0200
    Re: [PATCH 1/5] tools: Add err.h with ERR_PTR PTR_ERR interface Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-09-08 23:40 +0200
    [tip:perf/core] tools: Add err.h with ERR_PTR PTR_ERR interface tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-09-16 09:30 +0200
      Re: [tip:perf/core] tools: Add err.h with ERR_PTR PTR_ERR interface Vinson Lee <vlee@twopensource.com> - 2015-09-22 01:50 +0200
  [PATCH 3/5] perf tools: Propagate error info for the tracepoint parsing Jiri Olsa <jolsa@kernel.org> - 2015-09-07 10:40 +0200
    Re: [PATCH 3/5] perf tools: Propagate error info for the tracepoint parsing Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-09-08 23:50 +0200
      Re: [PATCH 3/5] perf tools: Propagate error info for the tracepoint  parsing Jiri Olsa <jolsa@redhat.com> - 2015-09-09 10:00 +0200
    Re: [PATCH 3/5] perf tools: Propagate error info for the tracepoint  parsing Matt Fleming <matt@codeblueprint.co.uk> - 2015-09-12 13:00 +0200
    [tip:perf/core] perf tools:   Propagate error info for the tracepoint parsing tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-09-16 09:30 +0200
  [PATCH 4/5] perf tools: Propagate error info from tp_format Jiri Olsa <jolsa@kernel.org> - 2015-09-07 10:40 +0200
    Re: [PATCH 4/5] perf tools: Propagate error info from tp_format Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-09 23:00 +0200
      Re: [PATCH 4/5] perf tools: Propagate error info from tp_format Jiri Olsa <jolsa@redhat.com> - 2015-09-10 10:30 +0200
        Re: [PATCH 4/5] perf tools: Propagate error info from tp_format Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-10 16:20 +0200
        Re: [PATCH 4/5] perf tools: Propagate error info from tp_format Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-14 23:00 +0200
          Re: [PATCH 4/5] perf tools: Propagate error info from tp_format Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-14 23:10 +0200
          Re: [PATCH 4/5] perf tools: Propagate error info from tp_format Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-09-14 23:10 +0200
            Re: [PATCH 4/5] perf tools: Propagate error info from tp_format Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> - 2015-09-14 23:40 +0200
              Re: [PATCH 4/5] perf tools: Propagate error info from tp_format Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-09-15 00:10 +0200
                Re: [PATCH 4/5] perf tools: Propagate error info from tp_format Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> - 2015-09-15 04:40 +0200
    [tip:perf/core] perf evsel: Propagate error info from tp_format tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-09-16 09:40 +0200

csiph-web