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
--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to