]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
perf: add page_faults_maj software perf event support
authorNitesh Konkar <niteshkonkar.libvirt@gmail.com>
Thu, 23 Feb 2017 14:55:36 +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 page_faults_maj 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 4ee3464d62a64d67020bc15c0b3c4bc43a5c9eaa..23508e2bff1ba5764e28c6f22595e7e9464976f6 100644 (file)
   &lt;event name='context_switches' enabled='no'/&gt;
   &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;/perf&gt;
 ...
 </pre>
           applications running on the platform</td>
       <td><code>perf.page_faults_min</code></td>
     </tr>
+    <tr>
+      <td><code>page_faults_maj</code></td>
+      <td>the count of major page faults, that is, where the
+          page was not present in the page cache, and
+          therefore had to be fetched from storage, by
+          applications running on the platform</td>
+      <td><code>perf.page_faults_maj</code></td>
+    </tr>
   </table>
 
     <h3><a name="elementsDevices">Devices</a></h3>
index b8914d5f4d8be5684f409b21935cc6227cf7d24f..82327c6d9f0b27e09b008e6f724b0cf3685a65a3 100644 (file)
               <value>context_switches</value>
               <value>cpu_migrations</value>
               <value>page_faults_min</value>
+              <value>page_faults_maj</value>
             </choice>
           </attribute>
           <attribute name="enabled">
index b7e6c712e2eea9ccec867a1aeaf3e92730253fde..f6e5c5a7604520214a3451a196513d0e14873f92 100644 (file)
@@ -2250,6 +2250,16 @@ void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats);
  */
 # define VIR_PERF_PARAM_PAGE_FAULTS_MIN  "page_faults_min"
 
+/**
+ * VIR_PERF_PARAM_PAGE_FAULTS_MAJ:
+ *
+ * Macro for typed parameter name that represents page_faults_maj
+ * perf event which can be used to measure the count of major page
+ * faults by applications running on the platform. It corresponds
+ * to the "perf.page_faults_maj" field in the *Stats APIs.
+ */
+# define VIR_PERF_PARAM_PAGE_FAULTS_MAJ  "page_faults_maj"
+
 int virDomainGetPerfEvents(virDomainPtr dom,
                            virTypedParameterPtr *params,
                            int *nparams,
index f0e4f8fe37b42fa0fcbd77fd8e0839cecbf35619..bfca1eacda357d5cfec7e7f61d92f14ff2c315d9 100644 (file)
@@ -11266,6 +11266,9 @@ virConnectGetDomainCapabilities(virConnectPtr conn,
  *     "perf.page_faults_min" - The count of minor page faults as unsigned
  *                              long long. It is produced by the
  *                              page_faults_min perf event.
+ *     "perf.page_faults_maj" - The count of major page faults as unsigned
+ *                              long long. It is produced by the
+ *                              page_faults_maj 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 02bd7caa3bc2d0e67484a11c76cb39651b8394c6..a2177d37426ae4818d7ac7dfb3956f218f05613e 100644 (file)
@@ -9573,6 +9573,7 @@ qemuDomainSetPerfEvents(virDomainPtr dom,
                                VIR_PERF_PARAM_CONTEXT_SWITCHES, VIR_TYPED_PARAM_BOOLEAN,
                                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,
                                NULL) < 0)
         return -1;
 
index 9e41df9c5172ddac4f486813c837a118910abb07..b3dd5c7897cabff868f0e09181c62fc96573ec83 100644 (file)
@@ -46,7 +46,7 @@ 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_min", "page_faults_maj");
 
 struct virPerfEvent {
     int type;
@@ -133,6 +133,9 @@ static struct virPerfEventAttr attrs[] = {
     {.type = VIR_PERF_EVENT_PAGE_FAULTS_MIN,
      .attrType = PERF_TYPE_SOFTWARE,
      .attrConfig = PERF_COUNT_SW_PAGE_FAULTS_MIN},
+    {.type = VIR_PERF_EVENT_PAGE_FAULTS_MAJ,
+     .attrType = PERF_TYPE_SOFTWARE,
+     .attrConfig = PERF_COUNT_SW_PAGE_FAULTS_MAJ},
 };
 typedef struct virPerfEventAttr *virPerfEventAttrPtr;
 
index aa90273a22391e29b264a4f420a9273466ff36ae..49d4ba7c6b769813a1b8489817fc204a91c6600a 100644 (file)
@@ -53,6 +53,7 @@ typedef enum {
     VIR_PERF_EVENT_CONTEXT_SWITCHES,   /* Count of context switches */
     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_LAST
 } virPerfEventType;
index 62ad97316890e2223bb875b32c1b7400941334f5..a5b6dfb50ded074314b789114ee3d90675d5b644 100644 (file)
@@ -32,6 +32,7 @@
     <event name='context_switches' enabled='yes'/>
     <event name='cpu_migrations' enabled='yes'/>
     <event name='page_faults_min' enabled='yes'/>
+    <event name='page_faults_maj' enabled='yes'/>
   </perf>
   <devices>
   </devices>
index 5c0876b1b29c67b3b64af1b39a2c854f8f7f4aef..3269e9c6b3f4333020223f2fc3987f03aafc2193 100644 (file)
@@ -970,6 +970,7 @@ I<--perf> returns the statistics of all enabled perf events:
  "perf.context_switches" - the count of context switches
  "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
 
 See the B<perf> command for more details about each event.
 
@@ -2351,6 +2352,8 @@ B<Valid perf event names>
                    applications running on the platform.
   page_faults_min - Provides the count minor page faults
                     by applications running on the platform.
+  page_faults_maj - Provides the count major page faults
+                    by applications running on the platform.
 
 B<Note>: The statistics can be retrieved using the B<domstats> command using
 the I<--perf> flag.