From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: Performance counters in kvm? Date: Wed, 13 Nov 2013 19:54:09 +0200 Message-ID: <20131113175409.GA2088@redhat.com> References: <5283AE31.1000303@cs.rutgers.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org To: "Binh Q. Pham" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:43767 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756795Ab3KMRye (ORCPT ); Wed, 13 Nov 2013 12:54:34 -0500 Content-Disposition: inline In-Reply-To: <5283AE31.1000303@cs.rutgers.edu> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Nov 13, 2013 at 11:52:01AM -0500, Binh Q. Pham wrote: > Hi all, > > I just started using kvm and want to use linux 'perf' tool inside > the virtual machine to get some information about the hardware > performance counters. I noticed in kvm source, there is pmu.c and > pmu-stubs.c, so I assume they provide support for PMU. However, when > I ran 'perf stat' in the VM, all hardware events are not supported. > Sample screen shot: > > perf stat /bin/ls > Performance counter stats for '/bin/ls': > cycles > stalled-cycles-frontend > .... > > Could someone clarify for me if I can use 'perf' in VM with the > current kvm state? > You need to specify host cpu type to QEMU: -cpu host. -- Gleb.