public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: acme@ghostprotocols.net, mingo@kernel.org, fweisbec@gmail.com,
	peterz@infradead.org, jolsa@redhat.com, namhyung@kernel.org,
	xiaoguangrong@linux.vnet.ibm.com, runzhen@linux.vnet.ibm.com,
	David Ahern <dsahern@gmail.com>
Subject: [PATCH 15/16] perf kvm: move the prompt_integer() to /util/top.c
Date: Sat, 25 May 2013 18:24:55 -0600	[thread overview]
Message-ID: <1369527896-3650-16-git-send-email-dsahern@gmail.com> (raw)
In-Reply-To: <1369527896-3650-1-git-send-email-dsahern@gmail.com>

As David suggested, this patch has no functional changes
just a code move.

move prompt_integer() from tools/perf/builtin-top.c  into
tools/perf/util/top.c

Signed-off-by: Runzhen Wang <runzhen@linux.vnet.ibm.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
---
 tools/perf/builtin-top.c |   26 --------------------------
 tools/perf/util/top.c    |   26 ++++++++++++++++++++++++++
 tools/perf/util/top.h    |    1 +
 3 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 495171a..cb7c308 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -298,32 +298,6 @@ static void perf_top__print_sym_table(struct perf_top *top)
 		       top->min_percent, stdout);
 }
 
-static void prompt_integer(int *target, const char *msg)
-{
-	char *buf = malloc(0), *p;
-	size_t dummy = 0;
-	int tmp;
-
-	fprintf(stdout, "\n%s: ", msg);
-	if (getline(&buf, &dummy, stdin) < 0)
-		return;
-
-	p = strchr(buf, '\n');
-	if (p)
-		*p = 0;
-
-	p = buf;
-	while(*p) {
-		if (!isdigit(*p))
-			goto out_free;
-		p++;
-	}
-	tmp = strtoul(buf, NULL, 10);
-	*target = tmp;
-out_free:
-	free(buf);
-}
-
 static void prompt_percent(int *target, const char *msg)
 {
 	int tmp = 0;
diff --git a/tools/perf/util/top.c b/tools/perf/util/top.c
index f857b51..1a2eaec 100644
--- a/tools/perf/util/top.c
+++ b/tools/perf/util/top.c
@@ -115,3 +115,29 @@ void perf_top__reset_sample_counters(struct perf_top *top)
 	top->exact_samples = top->guest_kernel_samples =
 	top->guest_us_samples = 0;
 }
+
+void prompt_integer(int *target, const char *msg)
+{
+	char *buf = malloc(0), *p;
+	size_t dummy = 0;
+	int tmp;
+
+	fprintf(stdout, "\n%s: ", msg);
+	if (getline(&buf, &dummy, stdin) < 0)
+		return;
+
+	p = strchr(buf, '\n');
+	if (p)
+		*p = 0;
+
+	p = buf;
+	while (*p) {
+		if (!isdigit(*p))
+			goto out_free;
+		p++;
+	}
+	tmp = strtoul(buf, NULL, 10);
+	*target = tmp;
+out_free:
+	free(buf);
+}
diff --git a/tools/perf/util/top.h b/tools/perf/util/top.h
index b554ffc..1538dab 100644
--- a/tools/perf/util/top.h
+++ b/tools/perf/util/top.h
@@ -43,4 +43,5 @@ struct perf_top {
 
 size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size);
 void perf_top__reset_sample_counters(struct perf_top *top);
+void prompt_integer(int *target, const char *msg);
 #endif /* __PERF_TOP_H */
-- 
1.7.10.1


  parent reply	other threads:[~2013-05-26  0:27 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-26  0:24 [PATCH 00/16] perf: kvm live mode David Ahern
2013-05-26  0:24 ` [PATCH 01/16] perf evlist: restore methods removed in earlier cleanup David Ahern
2013-05-26  0:24 ` [PATCH 02/16] perf evlist: move tracepoint processing code to evlist.c David Ahern
2013-05-26  0:24 ` [PATCH 03/16 v2] perf evlist: add initialzation function for tracepoints David Ahern
2013-05-26  0:24 ` [PATCH 04/16 v2] perf session: export a few functions for event processing David Ahern
2013-05-26  0:24 ` [PATCH 05/16] perf top: move CONSOLE_CLEAR to header file David Ahern
2013-05-26  0:24 ` [PATCH 06/16] perf kvm: handle realloc failures David Ahern
2013-05-31 11:49   ` [tip:perf/core] perf kvm: Handle " tip-bot for David Ahern
2013-05-26  0:24 ` [PATCH 07/16] perf kvm: split out tracepoints from record args David Ahern
2013-05-26  0:24 ` [PATCH 08/16] perf stats: fix divide by 0 in variance David Ahern
2013-05-31 11:51   ` [tip:perf/core] perf stats: Fix " tip-bot for David Ahern
2013-05-26  0:24 ` [PATCH 09/16] perf stats: add max and min stats David Ahern
2013-05-26  0:24 ` [PATCH 10/16 v2] perf kvm: add live mode David Ahern
2013-05-26  0:24 ` [PATCH 11/16] perf kvm: add min and max stats to display David Ahern
2013-05-26  0:24 ` [PATCH 12/16] perf kvm: option to print events that exceed a threshold David Ahern
2013-05-26  0:24 ` [PATCH 13/16] perf kvm: debug for missing vmexit/vmentry event David Ahern
2013-05-26  0:24 ` [PATCH 14/16] perf kvm: reuse some code of perf_kvm__timerfd_create() David Ahern
2013-09-12 13:08   ` Ingo Molnar
2013-09-12 13:34     ` David Ahern
2013-09-12 13:40       ` Ingo Molnar
2013-10-29 13:23         ` Ingo Molnar
2013-10-29 13:53           ` David Ahern
2013-10-29 13:58             ` Ingo Molnar
2013-05-26  0:24 ` David Ahern [this message]
2013-05-26  0:24 ` [PATCH 16/16] perf kvm: set live mode refresh time dynamically David Ahern

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=1369527896-3650-16-git-send-email-dsahern@gmail.com \
    --to=dsahern@gmail.com \
    --cc=acme@ghostprotocols.net \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=runzhen@linux.vnet.ibm.com \
    --cc=xiaoguangrong@linux.vnet.ibm.com \
    /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