[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 9/9] perf: add emulation_faults software perf event support




On 01/27/2017 06:01 AM, Nitesh Konkar wrote:
> This patch adds support and documentation
> for the emulation_faults perf event.
> 
> Signed-off-by: Nitesh Konkar <nitkon12 linux vnet ibm com>
> ---
>  docs/formatdomain.html.in                   |  7 +++++++
>  docs/news.xml                               |  5 +++--
>  docs/schemas/domaincommon.rng               |  1 +
>  include/libvirt/libvirt-domain.h            | 10 ++++++++++
>  src/libvirt-domain.c                        |  3 +++
>  src/qemu/qemu_driver.c                      |  1 +
>  src/util/virperf.c                          |  5 ++++-
>  src/util/virperf.h                          |  1 +
>  tests/genericxml2xmlindata/generic-perf.xml |  1 +
>  tools/virsh.pod                             |  5 +++++
>  10 files changed, 36 insertions(+), 3 deletions(-)
> 

similar comments here regarding news.xml, formatting the virsh.pod
output, and the length of the description (and where should it be).

John
> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> index 249cfe4..6a83a96 100644
> --- a/docs/formatdomain.html.in
> +++ b/docs/formatdomain.html.in
> @@ -1945,6 +1945,7 @@
>    &lt;event name='page_faults_min' enabled='no'/&gt;
>    &lt;event name='page_faults_maj' enabled='no'/&gt;
>    &lt;event name='alignment_faults' enabled='no'/&gt;
> +  &lt;event name='emulation_faults' enabled='no'/&gt;
>  &lt;/perf&gt;
>  ...
>  </pre>
> @@ -2066,6 +2067,12 @@
>            platform</td>
>        <td><code>perf.alignment_faults</code></td>
>      </tr>
> +    <tr>
> +      <td><code>emulation_faults</code></td>
> +      <td>the count of emulation faults by applications running on the
> +          platform</td>
> +      <td><code>perf.emulation_faults</code></td>
> +    </tr>
>    </table>
>  
>      <h3><a name="elementsDevices">Devices</a></h3>
> diff --git a/docs/news.xml b/docs/news.xml
> index b148b38..e0e1c50 100644
> --- a/docs/news.xml
> +++ b/docs/news.xml
> @@ -138,8 +138,9 @@
>            executed, branch misses, bus cycles, stalled frontend
>            cpu cycles, stalled backend cpu cycles, ref cpu cycles,
>            cpu clock, task clock, page faults, context switches,
> -          cpu migrations, page faults min, page faults maj and
> -          alignment faults by applications running on the platform.
> +          cpu migrations, page faults min, page faults maj,
> +          alignment faults and emulation faults by applications
> +          running on the platform.
>          </description>
>        </change>
>        <change>
> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> index 6782bf5..3781618 100644
> --- a/docs/schemas/domaincommon.rng
> +++ b/docs/schemas/domaincommon.rng
> @@ -441,6 +441,7 @@
>                <value>page_faults_min</value>
>                <value>page_faults_maj</value>
>                <value>alignment_faults</value>
> +              <value>emulation_faults</value>
>              </choice>
>            </attribute>
>            <attribute name="enabled">
> diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
> index 7523872..73974d9 100644
> --- a/include/libvirt/libvirt-domain.h
> +++ b/include/libvirt/libvirt-domain.h
> @@ -2268,6 +2268,16 @@ void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats);
>   */
>  # define VIR_PERF_PARAM_ALIGNMENT_FAULTS  "alignment_faults"
>  
> +/**
> + * VIR_PERF_PARAM_EMULATION_FAULTS:
> + *
> + * Macro for typed parameter name that represents emulation_faults
> + * perf event which can be used to measure the count of emulation
> + * faults by applications running on the platform. It corresponds
> + * to the "perf.emulation_faults" field in the *Stats APIs.
> + */
> +# define VIR_PERF_PARAM_EMULATION_FAULTS  "emulation_faults"
> +
>  int virDomainGetPerfEvents(virDomainPtr dom,
>                             virTypedParameterPtr *params,
>                             int *nparams,
> diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
> index bad9fea..36b7baa 100644
> --- a/src/libvirt-domain.c
> +++ b/src/libvirt-domain.c
> @@ -11271,6 +11271,9 @@ virConnectGetDomainCapabilities(virConnectPtr conn,
>   *     "perf.alignment_faults" - The count of alignment faults as unsigned long
>   *                              long. It is produced by the alignment_faults
>   *                              perf event
> + *     "perf.emulation_faults" - The count of emulation faults as unsigned long
> + *                              long. It is produced by the emulation_faults
> + *                              perf event
>   *
>   * Note that entire stats groups or individual stat fields may be missing from
>   * the output in case they are not supported by the given hypervisor, are not
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 89394be..f47ae92 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -9557,6 +9557,7 @@ qemuDomainSetPerfEvents(virDomainPtr dom,
>                                 VIR_PERF_PARAM_PAGE_FAULTS_MIN, VIR_TYPED_PARAM_BOOLEAN,
>                                 VIR_PERF_PARAM_PAGE_FAULTS_MAJ, VIR_TYPED_PARAM_BOOLEAN,
>                                 VIR_PERF_PARAM_ALIGNMENT_FAULTS, VIR_TYPED_PARAM_BOOLEAN,
> +                               VIR_PERF_PARAM_EMULATION_FAULTS, VIR_TYPED_PARAM_BOOLEAN,
>                                 NULL) < 0)
>          return -1;
>  
> diff --git a/src/util/virperf.c b/src/util/virperf.c
> index c25c57a..9a8f211 100644
> --- a/src/util/virperf.c
> +++ b/src/util/virperf.c
> @@ -47,7 +47,7 @@ VIR_ENUM_IMPL(virPerfEvent, VIR_PERF_EVENT_LAST,
>                "cpu_clock", "task_clock", "page_faults",
>                "context_switches", "cpu_migrations",
>                "page_faults_min", "page_faults_maj",
> -              "alignment_faults");
> +              "alignment_faults", "emulation_faults");
>  
>  struct virPerfEvent {
>      int type;
> @@ -140,6 +140,9 @@ static struct virPerfEventAttr attrs[] = {
>      {.type = VIR_PERF_EVENT_ALIGNMENT_FAULTS,
>       .attrType = PERF_TYPE_SOFTWARE,
>       .attrConfig = PERF_COUNT_SW_ALIGNMENT_FAULTS},
> +    {.type = VIR_PERF_EVENT_EMULATION_FAULTS,
> +     .attrType = PERF_TYPE_SOFTWARE,
> +     .attrConfig = PERF_COUNT_SW_EMULATION_FAULTS},
>  };
>  typedef struct virPerfEventAttr *virPerfEventAttrPtr;
>  
> diff --git a/src/util/virperf.h b/src/util/virperf.h
> index 1c51e50..0ef0d67 100644
> --- a/src/util/virperf.h
> +++ b/src/util/virperf.h
> @@ -55,6 +55,7 @@ typedef enum {
>      VIR_PERF_EVENT_PAGE_FAULTS_MIN,   /* Count of minor page faults */
>      VIR_PERF_EVENT_PAGE_FAULTS_MAJ,   /* Count of major page faults */
>      VIR_PERF_EVENT_ALIGNMENT_FAULTS,   /* Count of alignment faults */
> +    VIR_PERF_EVENT_EMULATION_FAULTS,   /* Count of emulation faults */
>  
>      VIR_PERF_EVENT_LAST
>  } virPerfEventType;
> diff --git a/tests/genericxml2xmlindata/generic-perf.xml b/tests/genericxml2xmlindata/generic-perf.xml
> index b48f96c..457aea0 100644
> --- a/tests/genericxml2xmlindata/generic-perf.xml
> +++ b/tests/genericxml2xmlindata/generic-perf.xml
> @@ -34,6 +34,7 @@
>      <event name='page_faults_min' enabled='yes'/>
>      <event name='page_faults_maj' enabled='yes'/>
>      <event name='alignment_faults' enabled='yes'/>
> +    <event name='emulation_faults' enabled='yes'/>
>    </perf>
>    <devices>
>    </devices>
> diff --git a/tools/virsh.pod b/tools/virsh.pod
> index 1f1b9c9..19d02a5 100644
> --- a/tools/virsh.pod
> +++ b/tools/virsh.pod
> @@ -954,6 +954,7 @@ I<--perf> returns the statistics of all enabled perf events:
>  "perf.page_faults_min" - the count of minor page faults
>  "perf.page_faults_maj" - the count of major page faults
>  "perf.alignment_faults" - the count of alignment faults
> +"perf.emulation_faults" - the count of emulation faults
>  
>  See the B<perf> command for more details about each event.
>  
> @@ -2340,6 +2341,10 @@ B<Valid perf event names>
>    alignment_faults - Provides the count of alignment faults, that is when
>                       the load or store is not aligned properly, by applications
>                       running on the platform
> +  emulation_faults - Provides the count of emulation faults, that is when
> +                     the kernel traps on unimplemented instrucions and
> +                     emulates them for user space, for applications running
> +                     on the platform
>  
>  B<Note>: The statistics can be retrieved using the B<domstats> command using
>  the I<--perf> flag.
> 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]