linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] buitin-kvm: Update cmd_kvm() to check perf_host value
@ 2024-05-15 19:52 yskelg
  2024-05-23  4:23 ` Namhyung Kim
  0 siblings, 1 reply; 3+ messages in thread
From: yskelg @ 2024-05-15 19:52 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Ian Rogers, Adrian Hunter
  Cc: Austin Kim, shjy180909, linux-perf-users, linux-kernel,
	Yunseong Kim

From: Yunseong Kim <yskelg@gmail.com>

According to perf-kvm.txt, the default operation is --guest, meaning
perf_host should be set to false and perf_guest to true. Currently,
the incorrect usage of --no-host and --no-guest still results in
the default --guest operation.

This patch updates the usage messages to include the --no-guest option
for those who only want host data, as well as the --no-host and
--no-guest case.

Signed-off-by: Yunseong Kim <yskelg@gmail.com>
---
 tools/perf/builtin-kvm.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 71165036e4ca..654a07658cdd 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -2129,7 +2129,7 @@ int cmd_kvm(int argc, const char **argv)
 		OPT_BOOLEAN(0, "guest", &perf_guest,
 			    "Collect guest os data"),
 		OPT_BOOLEAN(0, "host", &perf_host,
-			    "Collect host os data"),
+			   "Collect host os data. Host only with --host --no-guest"),
 		OPT_STRING(0, "guestmount", &symbol_conf.guestmount, "directory",
 			   "guest mount directory under which every guest os"
 			   " instance has a subdir"),
@@ -2150,16 +2150,23 @@ int cmd_kvm(int argc, const char **argv)
 						"buildid-list", "stat", NULL };
 	const char *kvm_usage[] = { NULL, NULL };
 
-	perf_host  = 0;
-	perf_guest = 1;
+	/*
+	 * tools/perf/Documentation/perf-kvm.txt
+	 *
+	 *    Default('')         ->  perf.data.guest
+	 *    --host              ->  perf.data.kvm
+	 *    --guest             ->  perf.data.guest
+	 *    --host --guest      ->  perf.data.kvm
+	 *    --host --no-guest   ->  perf.data.host
+	 */
+	perf_host = false;
+	perf_guest = true;
 
 	argc = parse_options_subcommand(argc, argv, kvm_options, kvm_subcommands, kvm_usage,
 					PARSE_OPT_STOP_AT_NON_OPTION);
-	if (!argc)
+	if (!argc || (!perf_host && !perf_guest))
 		usage_with_options(kvm_usage, kvm_options);
 
-	if (!perf_host)
-		perf_guest = 1;
 
 	if (!file_name) {
 		file_name = get_filename_for_perf_kvm();
-- 
2.34.1


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

end of thread, other threads:[~2024-05-27  6:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-15 19:52 [PATCH] buitin-kvm: Update cmd_kvm() to check perf_host value yskelg
2024-05-23  4:23 ` Namhyung Kim
2024-05-27  6:12   ` Yunseong Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).