All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Jueyuan Zhu <jueyuan.zhu@gmail.com>
Cc: Christopher Covington <cov@codeaurora.org>,
	linux-perf-users@vger.kernel.org
Subject: Re: How to measure VM events using perf-event
Date: Sat, 11 Apr 2015 08:59:20 -0300	[thread overview]
Message-ID: <20150411115920.GA3200@kernel.org> (raw)
In-Reply-To: <ABC4B897-7580-4EFC-B424-266D1E556498@gmail.com>

Em Fri, Apr 10, 2015 at 12:17:08PM -0400, Jueyuan Zhu escreveu:
> Hi Chris,
> 
> Thanks for your suggestions. Since I am using the perf_event_open in the host OS, not in the guest OS. So does it need the support of PMU virtualization? I used the perf command below to measure the VM, and it can give correct results. So I am wondering how to use perf_event_open to get the same results as the perf user command?
> 
> #perf stat -e instructions -p VM_id sleep 1
 
Try adding -vv to the above perf stat command, it will show you how it
is setting up perf_event_attr, as well as the other arguments to
sys_perf_event_open, for example:

[acme@zoo linux]$ perf stat -vv -e instructions usleep 1
------------------------------------------------------------
perf_event_attr:
  size                             112
  config                           1
  read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
  disabled                         1
  inherit                          1
  enable_on_exec                   1
  exclude_guest                    1
------------------------------------------------------------
sys_perf_event_open: pid 3530  cpu -1  group_fd -1  flags 0x8
instructions: 632294 767399 767399

 Performance counter stats for 'usleep 1':

           632.294      instructions                                                

       0,001521851 seconds time elapsed

[acme@zoo linux]$

- Arnaldo

      parent reply	other threads:[~2015-04-11 11:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-10  3:46 How to measure VM events using perf-event Jueyuan Zhu
2015-04-10 15:39 ` Christopher Covington
2015-04-10 16:17   ` Jueyuan Zhu
2015-04-10 16:57     ` Christopher Covington
2015-04-11  2:45     ` Tianwei Zhang
2015-04-11 11:59     ` Arnaldo Carvalho de Melo [this message]

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=20150411115920.GA3200@kernel.org \
    --to=acme@kernel.org \
    --cc=cov@codeaurora.org \
    --cc=jueyuan.zhu@gmail.com \
    --cc=linux-perf-users@vger.kernel.org \
    /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.