All of lore.kernel.org
 help / color / mirror / Atom feed
* QEMU-KVM metrics collection | Calculation of instructions performed from perf events
@ 2017-07-04  9:38 Elena Talkova
  2017-07-05 17:20 ` Andi Kleen
  0 siblings, 1 reply; 3+ messages in thread
From: Elena Talkova @ 2017-07-04  9:38 UTC (permalink / raw)
  To: linux-perf-users

Hi everyone,


I'm trying to gather metrics about the number of integer & floating point operations and instructions performed on different CPUs. In particular, I run perf from the host machine for regular processes and for qemu-kvm virtual machine processes.

I see that perf has multiple events related to this topic on each type of CPU I try it on. But I'm not sure of how to make sense of this data.

I have 2 problems so far:

1) I'm not sure how to use all available events to calculate number of instructions performed (integer and floating-points)

2) I get totally different results when running perf for a process on host machine and for a virtual machine process (with VM values often being just zeros)


So, my questions are:

1) Could you please specify any reliable sources of info on how to process these events in order to get number of instructions actually performed? I'm sure I'm not the only one interested in this and I want to learn how do other people do it instead of inventing my own bicycle.

2) Where should I look for differences in perf results for VM processes? Is there any workaround for that? Again, I'm talking here about qemu-kvm VMs in particular.


Here are the events I'm trying to work with for 2 CPU groups I'm using.

Sandy bridge:

FP_COMP_OPS_EXE.SSE_SCALAR_SINGLE

FP_COMP_OPS_EXE.SSE_SCALAR_DOUBLE

FP_COMP_OPS_EXE.SSE_PACKED_DOUBLE

FP_COMP_OPS_EXE.SSE_PACKED_SINGLE

SIMD_FP_256.PACKED_DOUBLE

SIMD_FP_256.PACKED_SINGLE

Broadwell, Skylake:

FP_ARITH_INST_RETIRED.SCALAR_SINGLE

FP_ARITH_INST_RETIRED.SCALAR_DOUBLE

FP_ARITH_INST_RETIRED.128B_PACKED_DOUBLE

FP_ARITH_INST_RETIRED.128B_PACKED_SINGLE

FP_ARITH_INST_RETIRED.256B_PACKED_DOUBLE

FP_ARITH_INST_RETIRED.256B_PACKED_SINGLE


Thanks!
Best regards, Elena

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

* Re: QEMU-KVM metrics collection | Calculation of instructions performed from perf events
  2017-07-04  9:38 QEMU-KVM metrics collection | Calculation of instructions performed from perf events Elena Talkova
@ 2017-07-05 17:20 ` Andi Kleen
  2017-07-10  9:31   ` Elena Talkova
  0 siblings, 1 reply; 3+ messages in thread
From: Andi Kleen @ 2017-07-05 17:20 UTC (permalink / raw)
  To: Elena Talkova; +Cc: linux-perf-users

Elena Talkova <e.talkova@zoho.eu> writes:
>
> I have 2 problems so far:
>
> 1) I'm not sure how to use all available events to calculate number of instructions performed (integer and floating-points)

You would need a better definition. There's no way
to count "all integer" instructions. Just all instructions,
or some specific classes of instructions.

If you need an exact instruction histogram the only
way is to use special instrumentation tools like pin.

> 2) I get totally different results when running perf for a process on
> host machine and for a virtual machine process (with VM values often
> being just zeros)

Measuring the counts from the host should work, except for
PEBS events.

> Sandy bridge:
>
> FP_COMP_OPS_EXE.SSE_SCALAR_SINGLE

These events are difficult to use because they include speculative and
re-issued execution, which can be high. Typically you need a significant
workload specific correction factor.

The retired Broadwell, Skylake events below don't have this problem. But it's
still not "all floating point" instructions, just all floating point
arithmetic.

-Andi

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

* Re: QEMU-KVM metrics collection | Calculation of instructions performed from perf events
  2017-07-05 17:20 ` Andi Kleen
@ 2017-07-10  9:31   ` Elena Talkova
  0 siblings, 0 replies; 3+ messages in thread
From: Elena Talkova @ 2017-07-10  9:31 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-perf-users


Hi Andi,

Thank you for your response. 

 > You would need a better definition. There's no way 
 > to count "all integer" instructions. Just all instructions, 
 > or some specific classes of instructions. 

Yes, makes sense. When you talk about the specific classes of instructions, which ones do you mean? For example, would it be possible to get data about such classes as addition, subtraction, multiplication and division?

From the other perspective, I've been trying to collect the data about integer/floating-point instructions performed to calculate corresponding OPS. Are there enough counters available for micro-operations so that I can get this info skipping the instructions data?

Thanks in advance for your attention :)

Best regards, Elena


 ---- On Wed, 05 Jul 2017 20:20:02 +0300 Andi Kleen <andi@firstfloor.org> wrote ---- 
 > Elena Talkova <e.talkova@zoho.eu> writes: 
 > > 
 > > I have 2 problems so far: 
 > > 
 > > 1) I'm not sure how to use all available events to calculate number of instructions performed (integer and floating-points) 
 >  
 > You would need a better definition. There's no way 
 > to count "all integer" instructions. Just all instructions, 
 > or some specific classes of instructions. 
 >  
 > If you need an exact instruction histogram the only 
 > way is to use special instrumentation tools like pin. 
 >  
 > > 2) I get totally different results when running perf for a process on 
 > > host machine and for a virtual machine process (with VM values often 
 > > being just zeros) 
 >  
 > Measuring the counts from the host should work, except for 
 > PEBS events. 
 >  
 > > Sandy bridge: 
 > > 
 > > FP_COMP_OPS_EXE.SSE_SCALAR_SINGLE 
 >  
 > These events are difficult to use because they include speculative and 
 > re-issued execution, which can be high. Typically you need a significant 
 > workload specific correction factor. 
 >  
 > The retired Broadwell, Skylake events below don't have this problem. But it's 
 > still not "all floating point" instructions, just all floating point 
 > arithmetic. 
 >  
 > -Andi 
 > -- 
 > 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 
 > 

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

end of thread, other threads:[~2017-07-10  9:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-04  9:38 QEMU-KVM metrics collection | Calculation of instructions performed from perf events Elena Talkova
2017-07-05 17:20 ` Andi Kleen
2017-07-10  9:31   ` Elena Talkova

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.