aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2011-04-29 16:52:42 -0400
committerIngo Molnar <mingo@elte.hu>2011-04-29 16:52:54 -0400
commit947b4ad1d198b7303ecc961f4939a331be0c48f0 (patch)
treee143b2ed2027ee4a9e35a73dc8c43763790988c8 /tools
parent301120396b766ae4480e52ece220516a1707822b (diff)
perf list: Fix max event string size
Recent stalled-cycles event names were larger than the 40 chars printout used by perf list. Extend that, make it robust for future extensions and also adjust alignments in face of wider event names. Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Link: http://lkml.kernel.org/n/tip-7y40wib8n009io7hjpn1dsrm@git.kernel.org Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/parse-events.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 8a407f3e286f..ffa493a24333 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -929,7 +929,7 @@ void print_tracepoint_events(const char *subsys_glob, const char *event_glob)
929 929
930 snprintf(evt_path, MAXPATHLEN, "%s:%s", 930 snprintf(evt_path, MAXPATHLEN, "%s:%s",
931 sys_dirent.d_name, evt_dirent.d_name); 931 sys_dirent.d_name, evt_dirent.d_name);
932 printf(" %-42s [%s]\n", evt_path, 932 printf(" %-50s [%s]\n", evt_path,
933 event_type_descriptors[PERF_TYPE_TRACEPOINT]); 933 event_type_descriptors[PERF_TYPE_TRACEPOINT]);
934 } 934 }
935 closedir(evt_dir); 935 closedir(evt_dir);
@@ -994,7 +994,7 @@ void print_events_type(u8 type)
994 else 994 else
995 snprintf(name, sizeof(name), "%s", syms->symbol); 995 snprintf(name, sizeof(name), "%s", syms->symbol);
996 996
997 printf(" %-42s [%s]\n", name, 997 printf(" %-50s [%s]\n", name,
998 event_type_descriptors[type]); 998 event_type_descriptors[type]);
999 } 999 }
1000} 1000}
@@ -1012,11 +1012,10 @@ int print_hwcache_events(const char *event_glob)
1012 for (i = 0; i < PERF_COUNT_HW_CACHE_RESULT_MAX; i++) { 1012 for (i = 0; i < PERF_COUNT_HW_CACHE_RESULT_MAX; i++) {
1013 char *name = event_cache_name(type, op, i); 1013 char *name = event_cache_name(type, op, i);
1014 1014
1015 if (event_glob != NULL && 1015 if (event_glob != NULL && !strglobmatch(name, event_glob))
1016 !strglobmatch(name, event_glob))
1017 continue; 1016 continue;
1018 1017
1019 printf(" %-42s [%s]\n", name, 1018 printf(" %-50s [%s]\n", name,
1020 event_type_descriptors[PERF_TYPE_HW_CACHE]); 1019 event_type_descriptors[PERF_TYPE_HW_CACHE]);
1021 ++printed; 1020 ++printed;
1022 } 1021 }
@@ -1026,14 +1025,16 @@ int print_hwcache_events(const char *event_glob)
1026 return printed; 1025 return printed;
1027} 1026}
1028 1027
1028#define MAX_NAME_LEN 100
1029
1029/* 1030/*
1030 * Print the help text for the event symbols: 1031 * Print the help text for the event symbols:
1031 */ 1032 */
1032void print_events(const char *event_glob) 1033void print_events(const char *event_glob)
1033{ 1034{
1034 struct event_symbol *syms = event_symbols;
1035 unsigned int i, type, prev_type = -1, printed = 0, ntypes_printed = 0; 1035 unsigned int i, type, prev_type = -1, printed = 0, ntypes_printed = 0;
1036 char name[40]; 1036 struct event_symbol *syms = event_symbols;
1037 char name[MAX_NAME_LEN];
1037 1038
1038 printf("\n"); 1039 printf("\n");
1039 printf("List of pre-defined events (to be used in -e):\n"); 1040 printf("List of pre-defined events (to be used in -e):\n");
@@ -1053,10 +1054,10 @@ void print_events(const char *event_glob)
1053 continue; 1054 continue;
1054 1055
1055 if (strlen(syms->alias)) 1056 if (strlen(syms->alias))
1056 sprintf(name, "%s OR %s", syms->symbol, syms->alias); 1057 snprintf(name, MAX_NAME_LEN, "%s OR %s", syms->symbol, syms->alias);
1057 else 1058 else
1058 strcpy(name, syms->symbol); 1059 strncpy(name, syms->symbol, MAX_NAME_LEN);
1059 printf(" %-42s [%s]\n", name, 1060 printf(" %-50s [%s]\n", name,
1060 event_type_descriptors[type]); 1061 event_type_descriptors[type]);
1061 1062
1062 prev_type = type; 1063 prev_type = type;
@@ -1073,12 +1074,12 @@ void print_events(const char *event_glob)
1073 return; 1074 return;
1074 1075
1075 printf("\n"); 1076 printf("\n");
1076 printf(" %-42s [%s]\n", 1077 printf(" %-50s [%s]\n",
1077 "rNNN (see 'perf list --help' on how to encode it)", 1078 "rNNN (see 'perf list --help' on how to encode it)",
1078 event_type_descriptors[PERF_TYPE_RAW]); 1079 event_type_descriptors[PERF_TYPE_RAW]);
1079 printf("\n"); 1080 printf("\n");
1080 1081
1081 printf(" %-42s [%s]\n", 1082 printf(" %-50s [%s]\n",
1082 "mem:<addr>[:access]", 1083 "mem:<addr>[:access]",
1083 event_type_descriptors[PERF_TYPE_BREAKPOINT]); 1084 event_type_descriptors[PERF_TYPE_BREAKPOINT]);
1084 printf("\n"); 1085 printf("\n");