aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2015-06-03 10:25:53 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-06-08 09:30:30 -0400
commita454742c1252d6242e00b5f4f6f9e5fbce3859d7 (patch)
tree804faf8f847bb99f69eba13ad231e36a9a1686c2
parent4c358d5cf36192f22b8d331779cb92e3ede9cddf (diff)
perf stat: Remove setup_events function
We can use already existing parse_events interface. Both transaction_attrs and transaction_limited_attrs are changed to be single strings. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Andi Kleen <ak@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1433341559-31848-4-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/builtin-stat.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 514493d703da..0c0071cf4fba 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -73,8 +73,8 @@ static void print_counter(struct perf_evsel *counter, char *prefix);
73static void print_aggr(char *prefix); 73static void print_aggr(char *prefix);
74 74
75/* Default events used for perf stat -T */ 75/* Default events used for perf stat -T */
76static const char * const transaction_attrs[] = { 76static const char *transaction_attrs = {
77 "task-clock", 77 "task-clock,"
78 "{" 78 "{"
79 "instructions," 79 "instructions,"
80 "cycles," 80 "cycles,"
@@ -86,8 +86,8 @@ static const char * const transaction_attrs[] = {
86}; 86};
87 87
88/* More limited version when the CPU does not have all events. */ 88/* More limited version when the CPU does not have all events. */
89static const char * const transaction_limited_attrs[] = { 89static const char * transaction_limited_attrs = {
90 "task-clock", 90 "task-clock,"
91 "{" 91 "{"
92 "instructions," 92 "instructions,"
93 "cycles," 93 "cycles,"
@@ -1533,17 +1533,6 @@ static int perf_stat_init_aggr_mode(void)
1533 return 0; 1533 return 0;
1534} 1534}
1535 1535
1536static int setup_events(const char * const *attrs, unsigned len)
1537{
1538 unsigned i;
1539
1540 for (i = 0; i < len; i++) {
1541 if (parse_events(evsel_list, attrs[i], NULL))
1542 return -1;
1543 }
1544 return 0;
1545}
1546
1547/* 1536/*
1548 * Add default attributes, if there were no attributes specified or 1537 * Add default attributes, if there were no attributes specified or
1549 * if -d/--detailed, -d -d or -d -d -d is used: 1538 * if -d/--detailed, -d -d or -d -d -d is used:
@@ -1665,12 +1654,10 @@ static int add_default_attributes(void)
1665 int err; 1654 int err;
1666 if (pmu_have_event("cpu", "cycles-ct") && 1655 if (pmu_have_event("cpu", "cycles-ct") &&
1667 pmu_have_event("cpu", "el-start")) 1656 pmu_have_event("cpu", "el-start"))
1668 err = setup_events(transaction_attrs, 1657 err = parse_events(evsel_list, transaction_attrs, NULL);
1669 ARRAY_SIZE(transaction_attrs));
1670 else 1658 else
1671 err = setup_events(transaction_limited_attrs, 1659 err = parse_events(evsel_list, transaction_limited_attrs, NULL);
1672 ARRAY_SIZE(transaction_limited_attrs)); 1660 if (err) {
1673 if (err < 0) {
1674 fprintf(stderr, "Cannot set up transaction events\n"); 1661 fprintf(stderr, "Cannot set up transaction events\n");
1675 return -1; 1662 return -1;
1676 } 1663 }