summaryrefslogtreecommitdiff
path: root/tools/perf/util/parse-events.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-06-15 10:31:38 +0400
committerIngo Molnar <mingo@kernel.org>2012-06-18 14:13:24 +0400
commit46010ab2607aed9484816a8f1679c2ec3c8e7dcf (patch)
tree1b54cb98c1744a5424a753123e05ac3b052dbb5b /tools/perf/util/parse-events.c
parent7c94ee2e0917b2ea56498bff939c8aa55da27207 (diff)
downloadlinux-46010ab2607aed9484816a8f1679c2ec3c8e7dcf.tar.xz
perf/tool: Use data struct for arg passing in event parse function
Moving all the bison arguments into the structure. In upcomming patches we are going to: - add more arguments - reuse the grammer for term parsing so it's more clear to pack/separate related arguments. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1339741902-8449-10-git-send-email-zheng.z.yan@intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util/parse-events.c')
-rw-r--r--tools/perf/util/parse-events.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 05dbc8b3c767..c71b29ad26ec 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -26,7 +26,7 @@ struct event_symbol {
#ifdef PARSER_DEBUG
extern int parse_events_debug;
#endif
-int parse_events_parse(struct list_head *list, int *idx);
+int parse_events_parse(void *data);
#define CHW(x) .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_##x
#define CSW(x) .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_##x
@@ -789,25 +789,27 @@ int parse_events_modifier(struct list_head *list, char *str)
int parse_events(struct perf_evlist *evlist, const char *str, int unset __used)
{
- LIST_HEAD(list);
- LIST_HEAD(list_tmp);
+ struct parse_events_data__events data = {
+ .list = LIST_HEAD_INIT(data.list),
+ .idx = evlist->nr_entries,
+ };
YY_BUFFER_STATE buffer;
- int ret, idx = evlist->nr_entries;
+ int ret;
buffer = parse_events__scan_string(str);
#ifdef PARSER_DEBUG
parse_events_debug = 1;
#endif
- ret = parse_events_parse(&list, &idx);
+ ret = parse_events_parse(&data);
parse_events__flush_buffer(buffer);
parse_events__delete_buffer(buffer);
parse_events_lex_destroy();
if (!ret) {
- int entries = idx - evlist->nr_entries;
- perf_evlist__splice_list_tail(evlist, &list, entries);
+ int entries = data.idx - evlist->nr_entries;
+ perf_evlist__splice_list_tail(evlist, &data.list, entries);
return 0;
}