]> xenbits.xensource.com Git - libvirt.git/commitdiff
perf: add stalled_cycles_backend perf event support
authorNitesh Konkar <niteshkonkar.libvirt@gmail.com>
Tue, 13 Dec 2016 16:01:40 +0000 (21:31 +0530)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 15 Dec 2016 21:47:05 +0000 (16:47 -0500)
This patch adds support and documentation for
the stalled_cycles_backend perf event.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
docs/formatdomain.html.in
docs/news.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 c6c2d2c7db726c28abc34a76b76abf6b860e94dc..357cb2d1e37df5cbe369e66924d9570605ccca63 100644 (file)
   &lt;event name='branch_misses' enabled='no'/&gt;
   &lt;event name='bus_cycles' enabled='no'/&gt;
   &lt;event name='stalled_cycles_frontend' enabled='no'/&gt;
+  &lt;event name='stalled_cycles_backend' enabled='no'/&gt;
 &lt;/perf&gt;
 ...
 </pre>
           processor pipeline by applications running on the platform</td>
       <td><code>perf.stalled_cycles_frontend</code></td>
     </tr>
+    <tr>
+      <td><code>stalled_cycles_backend</code></td>
+      <td>the count of stalled cpu cycles in the backend of the instruction
+          processor pipeline by applications running on the platform</td>
+      <td><code>perf.stalled_cycles_backend</code></td>
+    </tr>
   </table>
 
     <h3><a name="elementsDevices">Devices</a></h3>
index 52ac51d863b1cfc84125b36bcc487f31fb9651d2..c148f336f492264dfaddc1ffb9eb3e7945fdaf56 100644 (file)
@@ -36,8 +36,9 @@
         <ul>
           <li>perf: Add more perf statistics<br/>
           Add support to get the count of branch instructions
-          executed, branch misses, bus cycles, and stalled frontend
-          cpu cycles by applications running on the platform
+          executed, branch misses, bus cycles, stalled frontend
+          cpu cycles, and stalled backend cpu cycles by applications
+          running on the platform
           </li>
         </ul>
       </li>
index 9ce7cc9db29cd4356d39d9acba5a9a655c7941e3..e5b5fb5c7b9f82d2c134133dae653d25164d9ae1 100644 (file)
               <value>branch_misses</value>
               <value>bus_cycles</value>
               <value>stalled_cycles_frontend</value>
+              <value>stalled_cycles_backend</value>
             </choice>
           </attribute>
           <attribute name="enabled">
index 8d608ddb3fe5841a0c7071fb702c5bed47f5d5f3..ad9eef3573df8734af9d9147338135b86d4fc3d4 100644 (file)
@@ -2166,6 +2166,17 @@ void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats);
  */
 # define VIR_PERF_PARAM_STALLED_CYCLES_FRONTEND "stalled_cycles_frontend"
 
+/**
+ * VIR_PERF_PARAM_STALLED_CYCLES_BACKEND:
+ *
+ * Macro for typed parameter name that represents stalled_cycles_backend
+ * perf event which can be used to measure the count of stalled cpu cycles
+ * in the backend of the instruction processor pipeline by application
+ * running on the platform. It corresponds to the
+ * "perf.stalled_cycles_backend" field in the *Stats APIs.
+ */
+# define VIR_PERF_PARAM_STALLED_CYCLES_BACKEND "stalled_cycles_backend"
+
 int virDomainGetPerfEvents(virDomainPtr dom,
                            virTypedParameterPtr *params,
                            int *nparams,
index c438921adfa08125e99b02abc3e27bb6d8c3a931..d40760963fb5ae643d70c2f8d53b48cc3c87f6f1 100644 (file)
@@ -11241,6 +11241,11 @@ virConnectGetDomainCapabilities(virConnectPtr conn,
  *                                      pipeline as unsigned long long. It is
  *                                      produced by stalled_cycles_frontend
  *                                      perf event.
+ *     "perf.stalled_cycles_backend"  - The count of stalled cpu cycles in the
+ *                                      backend of the instruction processor
+ *                                      pipeline as unsigned long long. It is
+ *                                      produced by stalled_cycles_backend
+ *                                      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 45f8d562341928f4fb778d7fd909f68a88a87696..140a785fa0dfae96aedb8ccab4b5bed1e8377875 100644 (file)
@@ -9857,6 +9857,7 @@ qemuDomainSetPerfEvents(virDomainPtr dom,
                                VIR_PERF_PARAM_BRANCH_MISSES, VIR_TYPED_PARAM_BOOLEAN,
                                VIR_PERF_PARAM_BUS_CYCLES, VIR_TYPED_PARAM_BOOLEAN,
                                VIR_PERF_PARAM_STALLED_CYCLES_FRONTEND, VIR_TYPED_PARAM_BOOLEAN,
+                               VIR_PERF_PARAM_STALLED_CYCLES_BACKEND, VIR_TYPED_PARAM_BOOLEAN,
                                NULL) < 0)
         return -1;
 
index c21147a84522780d4f79223e5a8832454b54309f..c9a0e3948327a70bd696ed357228dc73fec733a9 100644 (file)
@@ -42,7 +42,8 @@ VIR_ENUM_IMPL(virPerfEvent, VIR_PERF_EVENT_LAST,
               "cpu_cycles", "instructions",
               "cache_references", "cache_misses",
               "branch_instructions", "branch_misses",
-              "bus_cycles", "stalled_cycles_frontend");
+              "bus_cycles", "stalled_cycles_frontend",
+              "stalled_cycles_backend");
 
 struct virPerfEvent {
     int type;
@@ -99,6 +100,9 @@ static struct virPerfEventAttr attrs[] = {
     {.type = VIR_PERF_EVENT_STALLED_CYCLES_FRONTEND,
      .attrType = PERF_TYPE_HARDWARE,
      .attrConfig = PERF_COUNT_HW_STALLED_CYCLES_FRONTEND},
+    {.type = VIR_PERF_EVENT_STALLED_CYCLES_BACKEND,
+     .attrType = PERF_TYPE_HARDWARE,
+     .attrConfig = PERF_COUNT_HW_STALLED_CYCLES_BACKEND},
 };
 typedef struct virPerfEventAttr *virPerfEventAttrPtr;
 
index a1ba3991714e32588320c1a6cc1c6a72c26dff0c..e5b9ae850c887e809fc66878cf69b003fbf680f7 100644 (file)
@@ -43,6 +43,9 @@ typedef enum {
     VIR_PERF_EVENT_STALLED_CYCLES_FRONTEND, /* Count of stalled cpu cycles in
                                                the frontend of the instruction
                                                processor pipeline */
+    VIR_PERF_EVENT_STALLED_CYCLES_BACKEND, /* Count of stalled cpu cycles in
+                                              the backend of the instruction
+                                              processor pipeline */
 
     VIR_PERF_EVENT_LAST
 } virPerfEventType;
index db7684327c3ace50c7f0168e28426abeccc93ef9..f01d574e6f8ac5f9d0caf705fa0361cb6702bf9d 100644 (file)
@@ -24,6 +24,7 @@
     <event name='branch_misses' enabled='yes'/>
     <event name='bus_cycles' enabled='yes'/>
     <event name='stalled_cycles_frontend' enabled='yes'/>
+    <event name='stalled_cycles_backend' enabled='yes'/>
   </perf>
   <devices>
   </devices>
index 1a45b529dc50ccc661d742498899f11c3166fdff..fb0758dfa0e959f8da11609882040a6606b8aae9 100644 (file)
@@ -949,7 +949,8 @@ I<--perf> returns the statistics of all enabled perf events:
 "perf.branch_instructions" - the count of branch instructions,
 "perf.branch_misses" - the count of branch misses,
 "perf.bus_cycles" - the count of bus cycles,
-"perf.stalled_cycles_frontend" - the count of stalled frontend cpu cycles
+"perf.stalled_cycles_frontend" - the count of stalled frontend cpu cycles,
+"perf.stalled_cycles_backend" - the count of stalled backend cpu cycles
 
 See the B<perf> command for more details about each event.
 
@@ -2307,6 +2308,10 @@ B<Valid perf event names>
                             cycles in the frontend of the
                             instruction processor pipeline by
                             applications running on the platform.
+  stalled_cycles_backend - Provides the count of stalled cpu
+                           cycles in the backend of the
+                           instruction processor pipeline by
+                           applications running on the platform.
 
 B<Note>: The statistics can be retrieved using the B<domstats> command using
 the I<--perf> flag.