aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/ui/browsers/hists.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-09-13 09:25:04 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-09-13 09:25:04 -0400
commit469917ce8717b9f8c5298bf279fa138859baab8d (patch)
tree584dcc382e0b3ee0431061753980d2f551b97563 /tools/perf/util/ui/browsers/hists.c
parent0c67b40872326a5340cab51d79a192a5fbaeb484 (diff)
perf ui browser: Don't use windows, slang is enough
They are useless and take away precious columns and lines, so stop using windows. One more step in removing newt code, that after all is not being useful at all for the coalescing TUI model in perf. Suggested-by: Christoph Hellwig <hch@infradead.org> Cc: Christoph Hellwig <hch@infradead.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <20100822082003.GB7365@infradead.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/ui/browsers/hists.c')
-rw-r--r--tools/perf/util/ui/browsers/hists.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c
index 2fc1ba3a468..ebda8c3fde9 100644
--- a/tools/perf/util/ui/browsers/hists.c
+++ b/tools/perf/util/ui/browsers/hists.c
@@ -293,19 +293,12 @@ static int hist_browser__run(struct hist_browser *self, const char *title)
293 int key; 293 int key;
294 int exit_keys[] = { 'a', '?', 'h', 'C', 'd', 'D', 'E', 't', 294 int exit_keys[] = { 'a', '?', 'h', 'C', 'd', 'D', 'E', 't',
295 NEWT_KEY_ENTER, NEWT_KEY_RIGHT, NEWT_KEY_LEFT, 0, }; 295 NEWT_KEY_ENTER, NEWT_KEY_RIGHT, NEWT_KEY_LEFT, 0, };
296 char str[256], unit;
297 unsigned long nr_events = self->hists->stats.nr_events[PERF_RECORD_SAMPLE];
298 296
299 self->b.entries = &self->hists->entries; 297 self->b.entries = &self->hists->entries;
300 self->b.nr_entries = self->hists->nr_entries; 298 self->b.nr_entries = self->hists->nr_entries;
301 299
302 hist_browser__refresh_dimensions(self); 300 hist_browser__refresh_dimensions(self);
303 301
304 nr_events = convert_unit(nr_events, &unit);
305 snprintf(str, sizeof(str), "Events: %lu%c ",
306 nr_events, unit);
307 newtDrawRootText(0, 0, str);
308
309 if (ui_browser__show(&self->b, title, 302 if (ui_browser__show(&self->b, title,
310 "Press '?' for help on key bindings") < 0) 303 "Press '?' for help on key bindings") < 0)
311 return -1; 304 return -1;
@@ -782,21 +775,26 @@ static struct thread *hist_browser__selected_thread(struct hist_browser *self)
782 return self->he_selection->thread; 775 return self->he_selection->thread;
783} 776}
784 777
785static int hist_browser__title(char *bf, size_t size, const char *ev_name, 778static int hists__browser_title(struct hists *self, char *bf, size_t size,
786 const struct dso *dso, const struct thread *thread) 779 const char *ev_name, const struct dso *dso,
780 const struct thread *thread)
787{ 781{
788 int printed = 0; 782 char unit;
783 int printed;
784 unsigned long nr_events = self->stats.nr_events[PERF_RECORD_SAMPLE];
785
786 nr_events = convert_unit(nr_events, &unit);
787 printed = snprintf(bf, size, "Events: %lu%c %s", nr_events, unit, ev_name);
789 788
790 if (thread) 789 if (thread)
791 printed += snprintf(bf + printed, size - printed, 790 printed += snprintf(bf + printed, size - printed,
792 "Thread: %s(%d)", 791 ", Thread: %s(%d)",
793 (thread->comm_set ? thread->comm : ""), 792 (thread->comm_set ? thread->comm : ""),
794 thread->pid); 793 thread->pid);
795 if (dso) 794 if (dso)
796 printed += snprintf(bf + printed, size - printed, 795 printed += snprintf(bf + printed, size - printed,
797 "%sDSO: %s", thread ? " " : "", 796 ", DSO: %s", dso->short_name);
798 dso->short_name); 797 return printed;
799 return printed ?: snprintf(bf, size, "Event: %s", ev_name);
800} 798}
801 799
802int hists__browse(struct hists *self, const char *helpline, const char *ev_name) 800int hists__browse(struct hists *self, const char *helpline, const char *ev_name)
@@ -817,9 +815,8 @@ int hists__browse(struct hists *self, const char *helpline, const char *ev_name)
817 815
818 ui_helpline__push(helpline); 816 ui_helpline__push(helpline);
819 817
820 hist_browser__title(msg, sizeof(msg), ev_name, 818 hists__browser_title(self, msg, sizeof(msg), ev_name,
821 dso_filter, thread_filter); 819 dso_filter, thread_filter);
822
823 while (1) { 820 while (1) {
824 const struct thread *thread; 821 const struct thread *thread;
825 const struct dso *dso; 822 const struct dso *dso;
@@ -957,8 +954,8 @@ zoom_out_dso:
957 pstack__push(fstack, &dso_filter); 954 pstack__push(fstack, &dso_filter);
958 } 955 }
959 hists__filter_by_dso(self, dso_filter); 956 hists__filter_by_dso(self, dso_filter);
960 hist_browser__title(msg, sizeof(msg), ev_name, 957 hists__browser_title(self, msg, sizeof(msg), ev_name,
961 dso_filter, thread_filter); 958 dso_filter, thread_filter);
962 hist_browser__reset(browser); 959 hist_browser__reset(browser);
963 } else if (choice == zoom_thread) { 960 } else if (choice == zoom_thread) {
964zoom_thread: 961zoom_thread:
@@ -975,8 +972,8 @@ zoom_out_thread:
975 pstack__push(fstack, &thread_filter); 972 pstack__push(fstack, &thread_filter);
976 } 973 }
977 hists__filter_by_thread(self, thread_filter); 974 hists__filter_by_thread(self, thread_filter);
978 hist_browser__title(msg, sizeof(msg), ev_name, 975 hists__browser_title(self, msg, sizeof(msg), ev_name,
979 dso_filter, thread_filter); 976 dso_filter, thread_filter);
980 hist_browser__reset(browser); 977 hist_browser__reset(browser);
981 } 978 }
982 } 979 }