All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Jes Sorensen <Jes.Sorensen@redhat.com>, kvm <kvm@vger.kernel.org>
Subject: Re: Wiki docs on counting and tracing KVM perf events
Date: Thu, 20 May 2010 15:14:52 +0300	[thread overview]
Message-ID: <4BF527BC.2030709@redhat.com> (raw)
In-Reply-To: <AANLkTin-PdfnHizJAc1Nr6pn_8qmeB0rLmRz6fStTzYw@mail.gmail.com>

On 05/20/2010 02:23 PM, Stefan Hajnoczi wrote:
> On Thu, May 20, 2010 at 12:16 PM, Jes Sorensen<Jes.Sorensen@redhat.com>  wrote:
>    
>> On 05/20/10 13:10, Avi Kivity wrote:
>>      
>>> What's wrong with starting perf after the warm-up period and stopping it
>>> before it's done?
>>>        
>> It's pretty hard to script.
>>      
> I use the following.  It ain't pretty:
>
> #!/bin/bash
> cleanup() {
>          trap - 2
>          kill -2 $sleep_pid
>          echo 0>/sys/kernel/debug/tracing/events/kvm/enable
>          kill $cat_pid
> }
>
> perf stat -a -e 'kvm:*' sleep 1h>results/perf_stat 2>&1&
> sleep_pid=$(sleep 1&&  pgrep -x -f "sleep 1h")   # sleep 1 is to avoid
> race with forked perf process
> trap cleanup 2
> echo 1>/sys/kernel/debug/tracing/events/kvm/enable
> cat /sys/kernel/debug/tracing/trace_pipe>results/trace&
> cat_pid=$!
>
> # ...do stuff here...
>
> cleanup
>    

perf will enable the events by itself (no?), so all you need is is the 
perf call in the middle.

What's missing is vmstat-like or kvm_stat-like output, but that's 
another thing.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


  reply	other threads:[~2010-05-20 12:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-13 14:35 Wiki docs on counting and tracing KVM perf events Stefan Hajnoczi
2010-05-13 14:57 ` Avi Kivity
2010-05-20  8:15   ` Jes Sorensen
2010-05-20  8:19     ` Avi Kivity
2010-05-20  8:24       ` Jes Sorensen
2010-05-20 11:05         ` Stefan Hajnoczi
2010-05-20 11:10           ` Avi Kivity
2010-05-20 11:16             ` Jes Sorensen
2010-05-20 11:23               ` Stefan Hajnoczi
2010-05-20 12:14                 ` Avi Kivity [this message]
2010-05-20 12:24                   ` Stefan Hajnoczi
2010-05-20 12:37                     ` Avi Kivity

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=4BF527BC.2030709@redhat.com \
    --to=avi@redhat.com \
    --cc=Jes.Sorensen@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=stefanha@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.