From: Christopher Covington <cov@codeaurora.org>
To: Jueyuan Zhu <jueyuan.zhu@gmail.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: How to measure VM events using perf-event
Date: Fri, 10 Apr 2015 12:57:06 -0400 [thread overview]
Message-ID: <552800E2.50006@codeaurora.org> (raw)
In-Reply-To: <ABC4B897-7580-4EFC-B424-266D1E556498@gmail.com>
Hi Jueyuan,
On 04/10/2015 12:17 PM, Jueyuan Zhu wrote:
> 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
Sorry, I overlooked that. I like to set pinned and inherit, but nothing jumps
out to me as wrong. If you'd like to look at more examples of using
perf_event_open, the test suite has the largest collection I know of.
https://github.com/deater/perf_event_tests
Chris
> On Apr 10, 2015, at 11:39 AM, Christopher Covington <cov@codeaurora.org> wrote:
>
>> Hi Jueyuan,
>>
>> On 04/09/2015 11:46 PM, Jueyuan Zhu wrote:
>>> Hello,
>>>
>>> I am trying to use the perf-event to measure the events for one specified
>>> VM in KVM platform. Since each VM is just a process in the host OS, so I thought
>>> we could just set the process id of this VM in the perf-event_open API to
>>> count the events. The following is my code (based on the example from
>>> perf_event_open linux manual).
>>
>>> However, this program’s output keeps constant whenever this VM is idle, or
>>> running different benchmarks. So it seems the event counting is incorrect. Can
>>> anyone tell me how to set the flags or perf_event_attr to correctly count the
>>> VM events using perf_event_open?
>>
>> You may want to check that the QEMU or kvmtool you're using correctly
>> virtualizes or emulates the PMU for your architecture. Information about this
>> might be in the documentation or release notes or if not you could try asking
>> on the QEMU or kvmtool mailing list tool.
>>
>> Chris
>>
>> --
>> Qualcomm Innovation Center, Inc.
>> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
>> a Linux Foundation Collaborative Project
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
next prev parent reply other threads:[~2015-04-10 16:57 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 [this message]
2015-04-11 2:45 ` Tianwei Zhang
2015-04-11 11:59 ` Arnaldo Carvalho de Melo
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=552800E2.50006@codeaurora.org \
--to=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 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).