[PATCH 1/3] perf, tool: Force guest machine definition option

From: Jiri Olsa
Date: Thu Apr 12 2012 - 08:21:24 EST


Running 'perf kvm record' without any of following options:
--guestmount
--guestvmlinux
--guestkallsyms
--guestmodules

is causing the guest machine to be ommited from the data file,
and all guest samples are counted in nr_unprocessable_samples.

This patch makes sure the 'perf kvm record' command is not
let through until one of the above option is specified.

Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
---
tools/perf/builtin-kvm.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 9fc6e0f..559d468 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -53,6 +53,16 @@ static int __cmd_record(int argc, const char **argv)
int rec_argc, i = 0, j;
const char **rec_argv;

+ if (perf_guest &&
+ !(symbol_conf.guestmount ||
+ symbol_conf.default_guest_vmlinux_name ||
+ symbol_conf.default_guest_modules ||
+ symbol_conf.default_guest_kallsyms)) {
+ ui__warning("You need to define guest with one of guestmount|"
+ "guestvmlinux|guestkallsyms|guestmodules\n");
+ return -EINVAL;
+ }
+
rec_argc = argc + 2;
rec_argv = calloc(rec_argc + 1, sizeof(char *));
rec_argv[i++] = strdup("record");
--
1.7.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/