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

2017-02-09 Thread John Ferlan


On 01/27/2017 06:01 AM, Nitesh Konkar wrote:
> This patch adds support and documentation
> for the alignment_faults perf event.
> 
> Signed-off-by: Nitesh Konkar 
> ---
>  docs/formatdomain.html.in   |  7 +++
>  docs/news.xml   |  4 ++--
>  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  |  6 +-
>  src/util/virperf.h  |  1 +
>  tests/genericxml2xmlindata/generic-perf.xml |  1 +
>  tools/virsh.pod |  4 
>  10 files changed, 35 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 50a6bdb..249cfe4 100644
> --- a/docs/formatdomain.html.in
> +++ b/docs/formatdomain.html.in
> @@ -1944,6 +1944,7 @@
>event name='cpu_migrations' enabled='no'/
>event name='page_faults_min' enabled='no'/
>event name='page_faults_maj' enabled='no'/
> +  event name='alignment_faults' enabled='no'/
>  /perf
>  ...
>  
> @@ -2059,6 +2060,12 @@
>platform
>perf.page_faults_maj
>  
> +
> +  alignment_faults
> +  the count of alignment faults by applications running on the
> +  platform
> +  perf.alignment_faults
> +
>
>  
>  Devices
> diff --git a/docs/news.xml b/docs/news.xml
> index fe533f2..b148b38 100644
> --- a/docs/news.xml
> +++ b/docs/news.xml
> @@ -138,8 +138,8 @@
>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 and page faults maj by
> -  applications running on the platform.
> +  cpu migrations, page faults min, page faults maj and
> +  alignment faults by applications running on the platform.
>  
>
>
> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> index 5f986d6..6782bf5 100644
> --- a/docs/schemas/domaincommon.rng
> +++ b/docs/schemas/domaincommon.rng
> @@ -440,6 +440,7 @@
>cpu_migrations
>page_faults_min
>page_faults_maj
> +  alignment_faults
>  
>
>
> diff --git a/include/libvirt/libvirt-domain.h 
> b/include/libvirt/libvirt-domain.h
> index d16200f..7523872 100644
> --- a/include/libvirt/libvirt-domain.h
> +++ b/include/libvirt/libvirt-domain.h
> @@ -2258,6 +2258,16 @@ void 
> virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats);
>   */
>  # define VIR_PERF_PARAM_PAGE_FAULTS_MAJ  "page_faults_maj"
>  
> +/**
> + * VIR_PERF_PARAM_ALIGNMENT_FAULTS:
> + *
> + * Macro for typed parameter name that represents alignment_faults
> + * perf event which can be used to measure the count of alignment
> + * faults by applications running on the platform. It corresponds
> + * to the "perf.alignment_faults" field in the *Stats APIs.
> + */
> +# define VIR_PERF_PARAM_ALIGNMENT_FAULTS  "alignment_faults"
> +
>  int virDomainGetPerfEvents(virDomainPtr dom,
> virTypedParameterPtr *params,
> int *nparams,
> diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
> index 1d7c181..bad9fea 100644
> --- a/src/libvirt-domain.c
> +++ b/src/libvirt-domain.c
> @@ -11268,6 +11268,9 @@ virConnectGetDomainCapabilities(virConnectPtr conn,
>   * "perf.page_faults_maj" - The count of major page faults as unsigned 
> long
>   *  long. It is produced by the page_faults_maj
>   *  perf event
> + * "perf.alignment_faults" - The count of alignment faults as unsigned 
> long
> + *  long. It is produced by the alignment_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 c88bf5a..89394be 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -9556,6 +9556,7 @@ qemuDomainSetPerfEvents(virDomainPtr dom,
> VIR_PERF_PARAM_CPU_MIGRATIONS, 
> VIR_TYPED_PARAM_BOOLEAN,
> 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, 
> 

[libvirt] [PATCH 8/9] perf: add alignment_faults software perf event support

2017-01-27 Thread Nitesh Konkar
This patch adds support and documentation
for the alignment_faults perf event.

Signed-off-by: Nitesh Konkar 
---
 docs/formatdomain.html.in   |  7 +++
 docs/news.xml   |  4 ++--
 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  |  6 +-
 src/util/virperf.h  |  1 +
 tests/genericxml2xmlindata/generic-perf.xml |  1 +
 tools/virsh.pod |  4 
 10 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 50a6bdb..249cfe4 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1944,6 +1944,7 @@
   event name='cpu_migrations' enabled='no'/
   event name='page_faults_min' enabled='no'/
   event name='page_faults_maj' enabled='no'/
+  event name='alignment_faults' enabled='no'/
 /perf
 ...
 
@@ -2059,6 +2060,12 @@
   platform
   perf.page_faults_maj
 
+
+  alignment_faults
+  the count of alignment faults by applications running on the
+  platform
+  perf.alignment_faults
+
   
 
 Devices
diff --git a/docs/news.xml b/docs/news.xml
index fe533f2..b148b38 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -138,8 +138,8 @@
   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 and page faults maj by
-  applications running on the platform.
+  cpu migrations, page faults min, page faults maj and
+  alignment faults by applications running on the platform.
 
   
   
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 5f986d6..6782bf5 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -440,6 +440,7 @@
   cpu_migrations
   page_faults_min
   page_faults_maj
+  alignment_faults
 
   
   
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index d16200f..7523872 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -2258,6 +2258,16 @@ void 
virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats);
  */
 # define VIR_PERF_PARAM_PAGE_FAULTS_MAJ  "page_faults_maj"
 
+/**
+ * VIR_PERF_PARAM_ALIGNMENT_FAULTS:
+ *
+ * Macro for typed parameter name that represents alignment_faults
+ * perf event which can be used to measure the count of alignment
+ * faults by applications running on the platform. It corresponds
+ * to the "perf.alignment_faults" field in the *Stats APIs.
+ */
+# define VIR_PERF_PARAM_ALIGNMENT_FAULTS  "alignment_faults"
+
 int virDomainGetPerfEvents(virDomainPtr dom,
virTypedParameterPtr *params,
int *nparams,
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 1d7c181..bad9fea 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -11268,6 +11268,9 @@ virConnectGetDomainCapabilities(virConnectPtr conn,
  * "perf.page_faults_maj" - The count of major page faults as unsigned long
  *  long. It is produced by the page_faults_maj
  *  perf event
+ * "perf.alignment_faults" - The count of alignment faults as unsigned long
+ *  long. It is produced by the alignment_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 c88bf5a..89394be 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -9556,6 +9556,7 @@ qemuDomainSetPerfEvents(virDomainPtr dom,
VIR_PERF_PARAM_CPU_MIGRATIONS, 
VIR_TYPED_PARAM_BOOLEAN,
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,
NULL) < 0)
 return -1;
 
diff --git a/src/util/virperf.c b/src/util/virperf.c
index 37f61e2..c25c57a 100644
--- a/src/util/virperf.c
+++ b/src/util/virperf.c
@@ -46,7 +46,8 @@ VIR_ENUM_IMPL(virPerfEvent, VIR_PERF_EVENT_LAST,
   "stalled_cycles_backend", "ref_cpu_cycles",
   "cpu_clock", "task_clock", "page_faults",
   "context_switches",