[PATCH 5/8] perf tools: Add support of name_only for print_events_type() function.

From: Dongsheng Yang
Date: Fri Dec 27 2013 - 05:07:14 EST

The all print_xxx_event() functions are supporting name_only argument except

This patch add an argument of name_only for print_events_type() function.

Signed-off-by: Dongsheng Yang <yangds.fnst@xxxxxxxxxxxxxx>
tools/perf/util/parse-events.c | 14 ++++++++------
tools/perf/util/parse-events.h | 2 +-
2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index eb0d0eef..9d7580b 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1122,7 +1122,7 @@ static bool is_event_supported(u8 type, unsigned config)

static unsigned int __print_events_type(u8 type, struct event_symbol *syms,
- unsigned max)
+ unsigned max, bool name_only)
char name[64];
unsigned i;
@@ -1137,20 +1137,22 @@ static unsigned int __print_events_type(u8 type, struct event_symbol *syms,
syms->symbol, syms->alias);
snprintf(name, sizeof(name), "%s", syms->symbol);
- printf(" %-50s [%s]\n", name, event_type_descriptors[type]);
+ if (name_only)
+ printf(" %-50s\n", name);
+ else
+ printf(" %-50s [%s]\n", name, event_type_descriptors[type]);

return count;

-unsigned int print_events_type(u8 type)
+unsigned int print_events_type(u8 type, bool name_only)
- return __print_events_type(type, event_symbols_sw, PERF_COUNT_SW_MAX);
+ return __print_events_type(type, event_symbols_sw, PERF_COUNT_SW_MAX, name_only);
- return __print_events_type(type, event_symbols_hw, PERF_COUNT_HW_MAX);
+ return __print_events_type(type, event_symbols_hw, PERF_COUNT_HW_MAX, name_only);

unsigned int print_hwcache_events(const char *event_glob, bool name_only)
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index bb7d674..148a767 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -102,7 +102,7 @@ void parse_events_update_lists(struct list_head *list_event,
void parse_events_error(void *data, void *scanner, char const *msg);

unsigned int print_events(const char *event_glob, bool name_only);
-unsigned int print_events_type(u8 type);
+unsigned int print_events_type(u8 type, bool name_only);
unsigned int print_tracepoint_events(const char *subsys_glob, const char *event_glob,
bool name_only);
unsigned int print_hwcache_events(const char *event_glob, bool name_only);

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