aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2011-03-07 15:13:41 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-03-10 08:55:00 -0500
commit6547250381eb315acff3d52b4872ad775359407c (patch)
tree24573d9f54451eaaaa88def26d1aa32d4b7dbb0c /tools
parentb9a46bba88001504235459c8410f17e6a7e38008 (diff)
perf top: Don't let events to eat up whole header line
Passing multiple events might force out information about pid/tid/cpu. Attached patch leaves 30 characters for this info at the expense of the events' names. Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Han Pingtian <phan@redhat.com> LKML-Reference: <1299528821-17521-3-git-send-email-jolsa@redhat.com> Signed-off-by: Jiri Olsa <jolsa@redhat.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/top.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/tools/perf/util/top.c b/tools/perf/util/top.c
index 4f869da4e9c7..75cfe4d45119 100644
--- a/tools/perf/util/top.c
+++ b/tools/perf/util/top.c
@@ -115,9 +115,23 @@ size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size)
115 if (!top->display_weighted) { 115 if (!top->display_weighted) {
116 ret += SNPRINTF(bf + ret, size - ret, "%s", 116 ret += SNPRINTF(bf + ret, size - ret, "%s",
117 event_name(top->sym_evsel)); 117 event_name(top->sym_evsel));
118 } else list_for_each_entry(counter, &top->evlist->entries, node) { 118 } else {
119 ret += SNPRINTF(bf + ret, size - ret, "%s%s", 119 /*
120 counter->idx ? "/" : "", event_name(counter)); 120 * Don't let events eat all the space. Leaving 30 bytes
121 * for the rest should be enough.
122 */
123 size_t last_pos = size - 30;
124
125 list_for_each_entry(counter, &top->evlist->entries, node) {
126 ret += SNPRINTF(bf + ret, size - ret, "%s%s",
127 counter->idx ? "/" : "",
128 event_name(counter));
129 if (ret > last_pos) {
130 sprintf(bf + last_pos - 3, "..");
131 ret = last_pos - 1;
132 break;
133 }
134 }
121 } 135 }
122 136
123 ret += SNPRINTF(bf + ret, size - ret, "], "); 137 ret += SNPRINTF(bf + ret, size - ret, "], ");