linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] perf kvm record: Change the default value of perf_guest to 0.
  2013-11-14 21:51 [PATCH] perf kvm record: Change the default value of perf_guest to 0 Dongsheng Yang
@ 2013-11-14 20:38 ` David Ahern
  2013-11-15 20:03   ` Dongsheng Yang
  0 siblings, 1 reply; 4+ messages in thread
From: David Ahern @ 2013-11-14 20:38 UTC (permalink / raw)
  To: Dongsheng Yang, mingo; +Cc: linux-kernel

On 11/14/13, 2:51 PM, Dongsheng Yang wrote:
> Currently, we can not record the event counters of host to perf.data.host.
> Example:
>     perf kvm --host record -a sleep 1
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.625 MB perf.data.guest (~27290 samples) ]

perf kvm by definition wants --guest enabled. Host profiling is done 
with just 'perf record'; no need for the kvm layer at all. If you really 
want to go through perf-kvm to record host events disable guest actions:

$ perf kvm --host --no-guest record -a sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.029 MB perf.data.host (~1255 samples) ]


David

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

* [PATCH] perf kvm record: Change the default value of perf_guest to 0.
@ 2013-11-14 21:51 Dongsheng Yang
  2013-11-14 20:38 ` David Ahern
  0 siblings, 1 reply; 4+ messages in thread
From: Dongsheng Yang @ 2013-11-14 21:51 UTC (permalink / raw)
  To: mingo; +Cc: linux-kernel, Dongsheng Yang

Currently, we can not record the event counters of host to perf.data.host.
Example:
   perf kvm --host record -a sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.625 MB perf.data.guest (~27290 samples) ]

The record file is named 'perf.data.kvm' and the content of it is about host
and guest. But we expect the record file is named 'perf.data.host' with the
counters only about host.

The issue was introduced by 1aed267(perf kvm: Do guest-only counting by default).

Actually, the following code can make sure that do guest-only by default:
    if (!perf_host)
        perf_guest = 1;

So, changing the default value from 0 to 1 is not a good idea, it prevents
us from getting 'perf.data.host' by '--host'.

With this patch applied, the behavior of perf-kvm is shown as below:
	* Default 	 -> perf.data.guest
	* --host  	 -> perf.data.host
	* --guest 	 -> perf.data.guest
	* --host --guest -> perf.data.kvm

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
---
 tools/perf/builtin-kvm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index cd9f920..eac8269 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -1709,8 +1709,7 @@ int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused)
 		NULL
 	};
 
-	perf_host  = 0;
-	perf_guest = 1;
+	perf_host = perf_guest = 0;
 
 	argc = parse_options(argc, argv, kvm_options, kvm_usage,
 			PARSE_OPT_STOP_AT_NON_OPTION);
-- 
1.8.2.1


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

* Re: [PATCH] perf kvm record: Change the default value of perf_guest to 0.
  2013-11-14 20:38 ` David Ahern
@ 2013-11-15 20:03   ` Dongsheng Yang
  0 siblings, 0 replies; 4+ messages in thread
From: Dongsheng Yang @ 2013-11-15 20:03 UTC (permalink / raw)
  To: David Ahern; +Cc: mingo, linux-kernel

Hi David:

On 11/14/2013 03:38 PM, David Ahern wrote:
> On 11/14/13, 2:51 PM, Dongsheng Yang wrote:
>> Currently, we can not record the event counters of host to 
>> perf.data.host.
>> Example:
>>     perf kvm --host record -a sleep 1
>> [ perf record: Woken up 1 times to write data ]
>> [ perf record: Captured and wrote 0.625 MB perf.data.guest (~27290 
>> samples) ]
>
> perf kvm by definition wants --guest enabled. Host profiling is done 
> with just 'perf record'; no need for the kvm layer at all. If you 
> really want to go through perf-kvm to record host events disable guest 
> actions:
>
> $ perf kvm --host --no-guest record -a sleep 1
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.029 MB perf.data.host (~1255 
> samples) ]
>
>
> David

Thanx for your reply ! It makes sense.



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

* [PATCH] perf kvm record: Change the default value of perf_guest to 0.
@ 2013-11-14 21:29 Dongsheng Yang
  0 siblings, 0 replies; 4+ messages in thread
From: Dongsheng Yang @ 2013-11-14 21:29 UTC (permalink / raw)
  To: mingo; +Cc: linux-kernel, yangds.fnst

Currently, we can not record the event counters of host to perf.data.host.
Example:
   perf kvm --host record -a sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.625 MB perf.data.guest (~27290 samples) ]

The record file is named 'perf.data.kvm' and the content of it is about host
and guest. But we expect the record file is named 'perf.data.host' with the
counters only about host.

The issue was introduced by 1aed267(perf kvm: Do guest-only counting by default).

Actually, the following code can make sure that do guest-only by default:
    if (!perf_host)
        perf_guest = 1;

So, changing the default value from 0 to 1 is not a good idea, it prevents
us from getting 'perf.data.host' by '--host'.

With this patch applied, the behavior of perf-kvm is shown as below:
	* Default 	 -> perf.data.guest
	* --host  	 -> perf.data.host
	* --guest 	 -> perf.data.guest
	* --host --guest -> perf.data.kvm

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
---
 tools/perf/builtin-kvm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index cd9f920..eac8269 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -1709,8 +1709,7 @@ int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused)
 		NULL
 	};
 
-	perf_host  = 0;
-	perf_guest = 1;
+	perf_host = perf_guest = 0;
 
 	argc = parse_options(argc, argv, kvm_options, kvm_usage,
 			PARSE_OPT_STOP_AT_NON_OPTION);
-- 
1.8.2.1


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

end of thread, other threads:[~2013-11-15  7:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-14 21:51 [PATCH] perf kvm record: Change the default value of perf_guest to 0 Dongsheng Yang
2013-11-14 20:38 ` David Ahern
2013-11-15 20:03   ` Dongsheng Yang
  -- strict thread matches above, loose matches on Subject: below --
2013-11-14 21:29 Dongsheng Yang

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).