]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
perf: add alignment_faults software perf event support
authorNitesh Konkar <niteshkonkar.libvirt@gmail.com>
Thu, 23 Feb 2017 14:55:37 +0000 (20:25 +0530)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 7 Mar 2017 18:51:05 +0000 (13:51 -0500)
This patch adds support and documentation
for the alignment_faults perf event.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
docs/formatdomain.html.in
docs/schemas/domaincommon.rng
include/libvirt/libvirt-domain.h
src/libvirt-domain.c
src/qemu/qemu_driver.c
src/util/virperf.c
src/util/virperf.h
tests/genericxml2xmlindata/generic-perf.xml
tools/virsh.pod

index 23508e2bff1ba5764e28c6f22595e7e9464976f6..680b98593feefc69a23f37f0247d74daeb27bb45 100644 (file)
   &lt;event name='cpu_migrations' enabled='no'/&gt;
   &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;/perf&gt;
 ...
 </pre>
           applications running on the platform</td>
       <td><code>perf.page_faults_maj</code></td>
     </tr>
+    <tr>
+      <td><code>alignment_faults</code></td>
+      <td>the count of alignment faults, that is when
+          the load or store is not aligned properly, by
+          applications running on the platform</td>
+      <td><code>perf.alignment_faults</code></td>
+    </tr>
   </table>
 
     <h3><a name="elementsDevices">Devices</a></h3>
index 82327c6d9f0b27e09b008e6f724b0cf3685a65a3..1f0c72914879465c6eb2a765eb11c21991bed6a9 100644 (file)
               <value>cpu_migrations</value>
               <value>page_faults_min</value>
               <value>page_faults_maj</value>
+              <value>alignment_faults</value>
             </choice>
           </attribute>
           <attribute name="enabled">
index f6e5c5a7604520214a3451a196513d0e14873f92..0c0fb182da7c598cddf9574196116b3f8a878ef6 100644 (file)
@@ -2260,6 +2260,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,
index bfca1eacda357d5cfec7e7f61d92f14ff2c315d9..012795202f5cb9a0df3d5c16424a87659c38167f 100644 (file)
@@ -11269,6 +11269,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
index a2177d37426ae4818d7ac7dfb3956f218f05613e..a6d8f141b5e35532ee87765dd9ccd7a13142a43c 100644 (file)
@@ -9574,6 +9574,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;
 
index b3dd5c7897cabff868f0e09181c62fc96573ec83..3f015965c2a2ad793e075f5b0d55c444a849cd72 100644 (file)
@@ -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", "cpu_migrations",
-              "page_faults_min", "page_faults_maj");
+              "page_faults_min", "page_faults_maj",
+              "alignment_faults");
 
 struct virPerfEvent {
     int type;
@@ -136,6 +137,9 @@ static struct virPerfEventAttr attrs[] = {
     {.type = VIR_PERF_EVENT_PAGE_FAULTS_MAJ,
      .attrType = PERF_TYPE_SOFTWARE,
      .attrConfig = PERF_COUNT_SW_PAGE_FAULTS_MAJ},
+    {.type = VIR_PERF_EVENT_ALIGNMENT_FAULTS,
+     .attrType = PERF_TYPE_SOFTWARE,
+     .attrConfig = PERF_COUNT_SW_ALIGNMENT_FAULTS},
 };
 typedef struct virPerfEventAttr *virPerfEventAttrPtr;
 
index 49d4ba7c6b769813a1b8489817fc204a91c6600a..4e464600ce3a5786af605220c498d5e1aeb0bd67 100644 (file)
@@ -54,6 +54,7 @@ typedef enum {
     VIR_PERF_EVENT_CPU_MIGRATIONS,   /* Count of cpu migrations */
     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_LAST
 } virPerfEventType;
index a5b6dfb50ded074314b789114ee3d90675d5b644..b48f96c38f44b832445d981d4e59e7a02a108153 100644 (file)
@@ -33,6 +33,7 @@
     <event name='cpu_migrations' enabled='yes'/>
     <event name='page_faults_min' enabled='yes'/>
     <event name='page_faults_maj' enabled='yes'/>
+    <event name='alignment_faults' enabled='yes'/>
   </perf>
   <devices>
   </devices>
index 3269e9c6b3f4333020223f2fc3987f03aafc2193..0fe4188c998f8154e9a8759a8608085933cdecdb 100644 (file)
@@ -971,6 +971,7 @@ I<--perf> returns the statistics of all enabled perf events:
  "perf.cpu_migrations" - the count of cpu migrations
  "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
 
 See the B<perf> command for more details about each event.
 
@@ -2354,6 +2355,8 @@ B<Valid perf event names>
                     by applications running on the platform.
   page_faults_maj - Provides the count major page faults
                     by applications running on the platform.
+  alignment_faults - Provides the count alignment faults
+                     by applications running on the platform.
 
 B<Note>: The statistics can be retrieved using the B<domstats> command using
 the I<--perf> flag.