]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
perf: add emulation_faults software perf event support
authorNitesh Konkar <niteshkonkar.libvirt@gmail.com>
Thu, 23 Feb 2017 14:55:38 +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 emulation_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 680b98593feefc69a23f37f0247d74daeb27bb45..68d664151dc3b5fdbb8b7ef02d47d5c2c2a46fd3 100644 (file)
   &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>
           applications running on the platform</td>
       <td><code>perf.alignment_faults</code></td>
     </tr>
+    <tr>
+      <td><code>emulation_faults</code></td>
+      <td>the count of emulation faults, that is when
+          the kernel traps on unimplemented instrucions
+          and emulates them for user space, by
+          applications running on the platform</td>
+      <td><code>perf.emulation_faults</code></td>
+    </tr>
   </table>
 
     <h3><a name="elementsDevices">Devices</a></h3>
index 1f0c72914879465c6eb2a765eb11c21991bed6a9..1860f9075b725f3e53e7ce6d88f082640843d058 100644 (file)
               <value>page_faults_min</value>
               <value>page_faults_maj</value>
               <value>alignment_faults</value>
+              <value>emulation_faults</value>
             </choice>
           </attribute>
           <attribute name="enabled">
index 0c0fb182da7c598cddf9574196116b3f8a878ef6..c490d712f22ebeb41b9fba4e090ed8e213502334 100644 (file)
@@ -2270,6 +2270,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,
index 012795202f5cb9a0df3d5c16424a87659c38167f..d8c88e06c476268098b46232473470dcc8aee7ae 100644 (file)
@@ -11272,6 +11272,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
index a6d8f141b5e35532ee87765dd9ccd7a13142a43c..639db74085024f2a7f36d8c8994340ccd0ee8067 100644 (file)
@@ -9575,6 +9575,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;
 
index 3f015965c2a2ad793e075f5b0d55c444a849cd72..e39cebbe0f175b3feb8f7b5ee23aa3f91e2dec95 100644 (file)
@@ -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;
 
index 4e464600ce3a5786af605220c498d5e1aeb0bd67..eee7a03d27771473fa81065d7e1f71177aa316b9 100644 (file)
@@ -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;
index b48f96c38f44b832445d981d4e59e7a02a108153..457aea0ef67ceaa0bb309adc212289e8d3e4e51e 100644 (file)
@@ -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>
index 0fe4188c998f8154e9a8759a8608085933cdecdb..ee790461136206c729f22daa26bf64afe94c39a8 100644 (file)
@@ -972,6 +972,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.
 
@@ -2357,6 +2358,8 @@ B<Valid perf event names>
                     by applications running on the platform.
   alignment_faults - Provides the count alignment faults
                      by applications running on the platform.
+  emulation_faults - Provides the count emulation faults
+                     by applications running on the platform.
 
 B<Note>: The statistics can be retrieved using the B<domstats> command using
 the I<--perf> flag.