public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] perf newt: Use newtGetScreenSize
@ 2010-03-12 15:46 Arnaldo Carvalho de Melo
  2010-03-12 15:46 ` [PATCH 2/2] perf hist: Don't fprintf the callgraph unconditionally Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-03-12 15:46 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo,
	Frédéric Weisbecker, Mike Galbraith, Peter Zijlstra,
	Paul Mackerras

From: Arnaldo Carvalho de Melo <acme@redhat.com>

For consistency, use the newt API more fully.

Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/newt.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index 2a4308a..f6ec6f5 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -52,7 +52,7 @@ static size_t hist_entry__append_browser(struct hist_entry *self,
 static void hist_entry__annotate_browser(struct hist_entry *self)
 {
 	FILE *fp;
-	struct winsize ws;
+	int cols, rows;
 	newtComponent form, listbox;
 	struct newtExitStruct es;
 	char *str;
@@ -71,8 +71,8 @@ static void hist_entry__annotate_browser(struct hist_entry *self)
 		goto out_free_str;
 
 	newtPushHelpLine("Press ESC to exit");
-	get_term_dimensions(&ws);
-	listbox = newtListbox(0, 0, ws.ws_row - 5, NEWT_FLAG_SCROLL);
+	newtGetScreenSize(&cols, &rows);
+	listbox = newtListbox(0, 0, rows - 5, NEWT_FLAG_SCROLL);
 
 	while (!feof(fp)) {
 		if (getline(&line, &line_len, fp) < 0 || !line_len)
@@ -87,13 +87,13 @@ static void hist_entry__annotate_browser(struct hist_entry *self)
 	fclose(fp);
 	free(line);
 
-	max_usable_width = ws.ws_col - 22;
+	max_usable_width = cols - 22;
 	if (max_line_len > max_usable_width)
 		max_line_len = max_usable_width;
 
 	newtListboxSetWidth(listbox, max_line_len);
 
-	newtCenteredWindow(max_line_len + 2, ws.ws_row - 5, self->sym->name);
+	newtCenteredWindow(max_line_len + 2, rows - 5, self->sym->name);
 	form = newt_form__new();
 	newtFormAddComponents(form, listbox, NULL);
 
@@ -112,7 +112,7 @@ void perf_session__browse_hists(struct rb_root *hists, u64 session_total,
 	struct rb_node *nd;
 	unsigned int width;
 	char *col_width = symbol_conf.col_width_list_str;
-	struct winsize ws;
+	int rows;
 	size_t max_len = 0;
 	char str[1024];
 	newtComponent form, listbox;
@@ -122,13 +122,13 @@ void perf_session__browse_hists(struct rb_root *hists, u64 session_total,
 	newtDrawRootText(0, 0, str);
 	newtPushHelpLine(helpline);
 
-	get_term_dimensions(&ws);
+	newtGetScreenSize(NULL, &rows);
 
 	form = newt_form__new();
 
-	listbox = newtListbox(1, 1, ws.ws_row - 2, (NEWT_FLAG_SCROLL |
-						    NEWT_FLAG_BORDER |
-						    NEWT_FLAG_RETURNEXIT));
+	listbox = newtListbox(1, 1, rows - 2, (NEWT_FLAG_SCROLL |
+					       NEWT_FLAG_BORDER |
+					       NEWT_FLAG_RETURNEXIT));
 
 	list_for_each_entry(se, &hist_entry__sort_list, list) {
 		if (se->elide)
-- 
1.6.2.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-03-14 14:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-12 15:46 [PATCH 1/2] perf newt: Use newtGetScreenSize Arnaldo Carvalho de Melo
2010-03-12 15:46 ` [PATCH 2/2] perf hist: Don't fprintf the callgraph unconditionally Arnaldo Carvalho de Melo
2010-03-14  9:47   ` Frederic Weisbecker
2010-03-14 14:21     ` Arnaldo Carvalho de Melo
2010-03-14 14:34       ` Frederic Weisbecker
2010-03-14 14:47       ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox