[PATCH 15/16] perf kvm: move the prompt_integer() to /util/top.c

From: David Ahern
Date: Sat May 25 2013 - 20:27:38 EST


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@xxxxxxxxxxxxxxxxxx>
Signed-off-by: David Ahern <dsahern@xxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Xiao Guangrong <xiaoguangrong@xxxxxxxxxxxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/