All of lore.kernel.org
 help / color / mirror / Atom feed
* perf, H/W counters - ESX hosted VM
@ 2011-05-27 19:33 David Ahern
  2011-05-27 22:51 ` Arun Sharma
  0 siblings, 1 reply; 2+ messages in thread
From: David Ahern @ 2011-05-27 19:33 UTC (permalink / raw)
  To: linux-perf-users, LKML


Has anyone successfully used perf within an ESX VM? dmesg shows a PMU is
discovered:

dmesg | grep -i performance
Performance Events: Nehalem/Corei7 events, Intel PMU driver.

yet data from it is nonsensical:

perf stat -v -- /tmp/a

task-clock-msecs: 20593318 20593318 20593318
context-switches: 2 20593318 20593318
CPU-migrations: 0 20593318 20593318
page-faults: 387 20593318 20593318
cycles: 10737418235 20593318 20593318
instructions: 10737418235 20593318 20593318
cache-references: 10737418235 20593318 20593318
cache-misses: 10737418235 20593318 20593318

 Performance counter stats for '/tmp/a':

      20.593318  task-clock-msecs         #      0.988 CPUs
              2  context-switches         #      0.000 M/sec
              0  CPU-migrations           #      0.000 M/sec
            387  page-faults              #      0.019 M/sec
    10737418235  cycles                   # 521403.022 M/sec
    10737418235  instructions             #      1.000 IPC
    10737418235  cache-references         # 521403.022 M/sec
    10737418235  cache-misses             # 521403.022 M/sec

    0.020837863  seconds time elapsed

David

/tmp/a  -- a step above 'sleep 1'

#!/bin/sh

declare -i i=0;
declare -i sum=0;
while [ $i -lt 1000 ]
do
	sum=$((sum + i))
    i=$((i+1))
done
echo "sum $sum"

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

* Re: perf, H/W counters - ESX hosted VM
  2011-05-27 19:33 perf, H/W counters - ESX hosted VM David Ahern
@ 2011-05-27 22:51 ` Arun Sharma
  0 siblings, 0 replies; 2+ messages in thread
From: Arun Sharma @ 2011-05-27 22:51 UTC (permalink / raw)
  To: David Ahern; +Cc: linux-perf-users, LKML

On Fri, May 27, 2011 at 01:33:54PM -0600, David Ahern wrote:
> 
> Has anyone successfully used perf within an ESX VM? dmesg shows a PMU is
> discovered:

Don't know about ESX. But in general, getting this right requires 
virtualizing PMU hardware (eg: save/restore PMU state on exit/entry
from the guest just the way the scheduler does for processes).

Also, the MSR read/writes to event-{select,count} registers must
be properly virtualized. Interrupt delivery (NMIs) is important
as well.

I suspect that MSR writes from the guest to the PMU related registers
are simply ignored in most virtual environments today.

 -Arun

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

end of thread, other threads:[~2011-05-27 22:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-27 19:33 perf, H/W counters - ESX hosted VM David Ahern
2011-05-27 22:51 ` Arun Sharma

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.