mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Namhyung Kim <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org,
	eranian@google.com, paulus@samba.org, hpa@zytor.com,
	mingo@kernel.org, a.p.zijlstra@chello.nl, minchan@kernel.org,
	namhyung.kim@lge.com, namhyung@kernel.org, jolsa@redhat.com,
	dsahern@gmail.com, tglx@linutronix.de
Subject: [tip:perf/core] perf top: Fix -E option behavior
Date: Fri, 31 May 2013 04:34:28 -0700	[thread overview]
Message-ID: <tip-933cbb1c6c617a6ae167538c2fa503efc9c4a832@git.kernel.org> (raw)
In-Reply-To: <1368497347-9628-2-git-send-email-namhyung@kernel.org>

Commit-ID:  933cbb1c6c617a6ae167538c2fa503efc9c4a832
Gitweb:     http://git.kernel.org/tip/933cbb1c6c617a6ae167538c2fa503efc9c4a832
Author:     Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Tue, 14 May 2013 11:08:59 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 28 May 2013 16:23:59 +0300

perf top: Fix -E option behavior

The -E/--entries option controls how many lines to be printed on stdio
output but it doesn't work as it should be:

If -E option is specified, print that many lines regardless of current
window size, if not automatically adjust number of lines printed to fit
into the window size.

Reported-by: Minchan Kim <minchan@kernel.org>
Tested-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1368497347-9628-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-top.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index df9e06a..81adcaf 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -70,10 +70,11 @@
 
 static volatile int done;
 
+#define HEADER_LINE_NR  5
+
 static void perf_top__update_print_entries(struct perf_top *top)
 {
-	if (top->print_entries > 9)
-		top->print_entries -= 9;
+	top->print_entries = top->winsize.ws_row - HEADER_LINE_NR;
 }
 
 static void perf_top__sig_winch(int sig __maybe_unused,
@@ -82,13 +83,6 @@ static void perf_top__sig_winch(int sig __maybe_unused,
 	struct perf_top *top = arg;
 
 	get_term_dimensions(&top->winsize);
-	if (!top->print_entries
-	    || (top->print_entries+4) > top->winsize.ws_row) {
-		top->print_entries = top->winsize.ws_row;
-	} else {
-		top->print_entries += 4;
-		top->winsize.ws_row = top->print_entries;
-	}
 	perf_top__update_print_entries(top);
 }
 
@@ -296,10 +290,10 @@ static void perf_top__print_sym_table(struct perf_top *top)
 				      top->hide_user_symbols,
 				      top->hide_kernel_symbols);
 	hists__output_recalc_col_len(&top->sym_evsel->hists,
-				     top->winsize.ws_row - 3);
+				     top->print_entries - printed);
 	putchar('\n');
 	hists__fprintf(&top->sym_evsel->hists, false,
-		       top->winsize.ws_row - 4 - printed, win_width, stdout);
+		       top->print_entries - printed, win_width, stdout);
 }
 
 static void prompt_integer(int *target, const char *msg)
@@ -477,7 +471,6 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c)
 				perf_top__sig_winch(SIGWINCH, NULL, top);
 				sigaction(SIGWINCH, &act, NULL);
 			} else {
-				perf_top__sig_winch(SIGWINCH, NULL, top);
 				signal(SIGWINCH, SIG_DFL);
 			}
 			break;

  parent reply	other threads:[~2013-05-31 11:35 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-14  2:08 [PATCHSET 0/9] perf tools: Assorted fixes and changes on perf top/report Namhyung Kim
2013-05-14  2:08 ` [PATCH 1/9] perf top: Fix -E option behavior Namhyung Kim
2013-05-17 14:21   ` Jiri Olsa
2013-05-31 11:34   ` tip-bot for Namhyung Kim [this message]
2013-05-14  2:09 ` [PATCH 2/9] perf top: Fix percent output when no samples collected Namhyung Kim
2013-05-17 14:22   ` Jiri Olsa
2013-05-31 11:35   ` [tip:perf/core] " tip-bot for Namhyung Kim
2013-05-14  2:09 ` [PATCH 3/9] perf top: Get rid of *_threaded() functions Namhyung Kim
2013-05-17 14:28   ` Jiri Olsa
2013-05-31 11:37   ` [tip:perf/core] " tip-bot for Namhyung Kim
2013-05-14  2:09 ` [PATCH 4/9] perf hists: Move locking to its call-sites Namhyung Kim
2013-05-17 14:39   ` Jiri Olsa
2013-05-31 11:38   ` [tip:perf/core] " tip-bot for Namhyung Kim
2013-05-14  2:09 ` [PATCH 5/9] perf report: Don't be bothered with locking when adding hist entries Namhyung Kim
2013-05-17 14:39   ` Jiri Olsa
2013-05-31 11:39   ` [tip:perf/core] perf report: Don' t bother " tip-bot for Namhyung Kim
2013-05-14  2:09 ` [PATCH 6/9] perf report: Add --percent-limit option Namhyung Kim
2013-05-31 11:40   ` [tip:perf/core] " tip-bot for Namhyung Kim
2013-05-14  2:09 ` [PATCH 7/9] perf top: " Namhyung Kim
2013-05-31 11:42   ` [tip:perf/core] " tip-bot for Namhyung Kim
2013-05-14  2:09 ` [PATCH 8/9] perf report: Add report.percent-limit config variable Namhyung Kim
2013-05-14 11:05   ` Pekka Enberg
2013-05-15 10:08     ` Namhyung Kim
2013-05-16  7:34       ` Pekka Enberg
2013-05-31 11:43   ` [tip:perf/core] " tip-bot for Namhyung Kim
2013-05-14  2:09 ` [PATCH 9/9] perf top: Reuse " Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-933cbb1c6c617a6ae167538c2fa503efc9c4a832@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=minchan@kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung.kim@lge.com \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome