]> xenbits.xensource.com Git - libvirt.git/commitdiff
perf: add stalled_cycles_frontend perf event support
authorNitesh Konkar <niteshkonkar.libvirt@gmail.com>
Tue, 13 Dec 2016 16:01:39 +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_frontend 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 cd3182bb6f40d7580c936d6e6f86d20034c1b6b7..c6c2d2c7db726c28abc34a76b76abf6b860e94dc 100644 (file)
   &lt;event name='branch_instructions' enabled='no'/&gt;
   &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;/perf&gt;
 ...
 </pre>
       <td>the count of bus cycles by applications running on the platform</td>
       <td><code>perf.bus_cycles</code></td>
     </tr>
+    <tr>
+      <td><code>stalled_cycles_frontend</code></td>
+      <td>the count of stalled cpu cycles in the frontend of the instruction
+          processor pipeline by applications running on the platform</td>
+      <td><code>perf.stalled_cycles_frontend</code></td>
+    </tr>
   </table>
 
     <h3><a name="elementsDevices">Devices</a></h3>
index 09e4c9544ac2870aca5d3101bd4c0115108a8f3e..52ac51d863b1cfc84125b36bcc487f31fb9651d2 100644 (file)
@@ -35,9 +35,9 @@
       <li><strong>Improvements</strong>
         <ul>
           <li>perf: Add more perf statistics<br/>
-          Add support to get the count of branch instructions executed,
-          branch misses, and bus cycles by applications running on
-          the platform
+          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
           </li>
         </ul>
       </li>
index 21a7afa47fd450f609b378bb909fc75bbf6a9df7..9ce7cc9db29cd4356d39d9acba5a9a655c7941e3 100644 (file)
               <value>branch_instructions</value>
               <value>branch_misses</value>
               <value>bus_cycles</value>
+              <value>stalled_cycles_frontend</value>
             </choice>
           </attribute>
           <attribute name="enabled">
index 6d74238bbd2c4928fccf69cfb3c161e860e9f878..8d608ddb3fe5841a0c7071fb702c5bed47f5d5f3 100644 (file)
@@ -2155,6 +2155,17 @@ void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats);
  */
 # define VIR_PERF_PARAM_BUS_CYCLES "bus_cycles"
 
+/**
+ * VIR_PERF_PARAM_STALLED_CYCLES_FRONTEND:
+ *
+ * Macro for typed parameter name that represents stalled_cycles_frontend
+ * perf event which can be used to measure the count of stalled cpu cycles
+ * in the frontend of the instruction processor pipeline by applications
+ * running on the platform. It corresponds to the
+ * "perf.stalled_cycles_frontend" field in the *Stats APIs.
+ */
+# define VIR_PERF_PARAM_STALLED_CYCLES_FRONTEND "stalled_cycles_frontend"
+
 int virDomainGetPerfEvents(virDomainPtr dom,
                            virTypedParameterPtr *params,
                            int *nparams,
index 821801126706c6c59ad391cf8bf7925a5d341e8f..c438921adfa08125e99b02abc3e27bb6d8c3a931 100644 (file)
@@ -11236,6 +11236,11 @@ virConnectGetDomainCapabilities(virConnectPtr conn,
  *                            long. It is produced by branch_misses perf event.
  *     "perf.bus_cycles" - The count of bus cycles as unsigned long
  *                         long. It is produced by bus_cycles perf event.
+ *     "perf.stalled_cycles_frontend" - The count of stalled cpu cycles in the
+ *                                      frontend of the instruction processor
+ *                                      pipeline as unsigned long long. It is
+ *                                      produced by stalled_cycles_frontend
+ *                                      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 ee99d6f805bf2a4f3573bff00571b2b48dc89920..45f8d562341928f4fb778d7fd909f68a88a87696 100644 (file)
@@ -9856,6 +9856,7 @@ qemuDomainSetPerfEvents(virDomainPtr dom,
                                VIR_PERF_PARAM_BRANCH_INSTRUCTIONS, VIR_TYPED_PARAM_BOOLEAN,
                                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,
                                NULL) < 0)
         return -1;
 
index 31a55859651d3632e9744029cc69a2ed8f14f533..c21147a84522780d4f79223e5a8832454b54309f 100644 (file)
@@ -42,7 +42,7 @@ VIR_ENUM_IMPL(virPerfEvent, VIR_PERF_EVENT_LAST,
               "cpu_cycles", "instructions",
               "cache_references", "cache_misses",
               "branch_instructions", "branch_misses",
-              "bus_cycles");
+              "bus_cycles", "stalled_cycles_frontend");
 
 struct virPerfEvent {
     int type;
@@ -96,6 +96,9 @@ static struct virPerfEventAttr attrs[] = {
     {.type = VIR_PERF_EVENT_BUS_CYCLES,
      .attrType = PERF_TYPE_HARDWARE,
      .attrConfig = PERF_COUNT_HW_BUS_CYCLES},
+    {.type = VIR_PERF_EVENT_STALLED_CYCLES_FRONTEND,
+     .attrType = PERF_TYPE_HARDWARE,
+     .attrConfig = PERF_COUNT_HW_STALLED_CYCLES_FRONTEND},
 };
 typedef struct virPerfEventAttr *virPerfEventAttrPtr;
 
index ac6d7895186b7d46969b65f0c3a50d10ec2fee20..a1ba3991714e32588320c1a6cc1c6a72c26dff0c 100644 (file)
@@ -40,6 +40,9 @@ typedef enum {
                                            for applications */
     VIR_PERF_EVENT_BRANCH_MISSES,  /* Count of branch misses for applications */
     VIR_PERF_EVENT_BUS_CYCLES,       /* Count of bus cycles for applications*/
+    VIR_PERF_EVENT_STALLED_CYCLES_FRONTEND, /* Count of stalled cpu cycles in
+                                               the frontend of the instruction
+                                               processor pipeline */
 
     VIR_PERF_EVENT_LAST
 } virPerfEventType;
index 56a6173796bde9409623c58388098e0d1a499974..db7684327c3ace50c7f0168e28426abeccc93ef9 100644 (file)
@@ -23,6 +23,7 @@
     <event name='branch_instructions' enabled='yes'/>
     <event name='branch_misses' enabled='yes'/>
     <event name='bus_cycles' enabled='yes'/>
+    <event name='stalled_cycles_frontend' enabled='yes'/>
   </perf>
   <devices>
   </devices>
index 7b3cb74cb41c14dfde41ac7a17cc995c25c382f1..1a45b529dc50ccc661d742498899f11c3166fdff 100644 (file)
@@ -948,7 +948,8 @@ I<--perf> returns the statistics of all enabled perf events:
 "perf.cache_misses" - the count of caches misses,
 "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.bus_cycles" - the count of bus cycles,
+"perf.stalled_cycles_frontend" - the count of stalled frontend cpu cycles
 
 See the B<perf> command for more details about each event.
 
@@ -2302,6 +2303,10 @@ B<Valid perf event names>
                      by applications running on the platform.
   bus_cycles       - Provides the count of bus cycles executed
                      by applications running on the platform.
+  stalled_cycles_frontend - Provides the count of stalled cpu
+                            cycles in the frontend 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.