perf: add stalled_cycles_backend perf event support

This patch adds support and documentation for
the stalled_cycles_backend perf event.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
This commit is contained in:
Nitesh Konkar 2016-12-13 21:31:40 +05:30 committed by John Ferlan
parent 060c159b08
commit 9ae79400ff
10 changed files with 43 additions and 4 deletions

View File

@ -1931,6 +1931,7 @@
&lt;event name='branch_misses' enabled='no'/&gt; &lt;event name='branch_misses' enabled='no'/&gt;
&lt;event name='bus_cycles' 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_frontend' enabled='no'/&gt;
&lt;event name='stalled_cycles_backend' enabled='no'/&gt;
&lt;/perf&gt; &lt;/perf&gt;
... ...
</pre> </pre>
@ -1997,6 +1998,12 @@
processor pipeline by applications running on the platform</td> processor pipeline by applications running on the platform</td>
<td><code>perf.stalled_cycles_frontend</code></td> <td><code>perf.stalled_cycles_frontend</code></td>
</tr> </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> </table>
<h3><a name="elementsDevices">Devices</a></h3> <h3><a name="elementsDevices">Devices</a></h3>

View File

@ -36,8 +36,9 @@
<ul> <ul>
<li>perf: Add more perf statistics<br/> <li>perf: Add more perf statistics<br/>
Add support to get the count of branch instructions Add support to get the count of branch instructions
executed, branch misses, bus cycles, and stalled frontend executed, branch misses, bus cycles, stalled frontend
cpu cycles by applications running on the platform cpu cycles, and stalled backend cpu cycles by applications
running on the platform
</li> </li>
</ul> </ul>
</li> </li>

View File

@ -431,6 +431,7 @@
<value>branch_misses</value> <value>branch_misses</value>
<value>bus_cycles</value> <value>bus_cycles</value>
<value>stalled_cycles_frontend</value> <value>stalled_cycles_frontend</value>
<value>stalled_cycles_backend</value>
</choice> </choice>
</attribute> </attribute>
<attribute name="enabled"> <attribute name="enabled">

View File

@ -2166,6 +2166,17 @@ void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats);
*/ */
# define VIR_PERF_PARAM_STALLED_CYCLES_FRONTEND "stalled_cycles_frontend" # 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, int virDomainGetPerfEvents(virDomainPtr dom,
virTypedParameterPtr *params, virTypedParameterPtr *params,
int *nparams, int *nparams,

View File

@ -11241,6 +11241,11 @@ virConnectGetDomainCapabilities(virConnectPtr conn,
* pipeline as unsigned long long. It is * pipeline as unsigned long long. It is
* produced by stalled_cycles_frontend * produced by stalled_cycles_frontend
* perf event. * 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 * 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 * the output in case they are not supported by the given hypervisor, are not

View File

@ -9857,6 +9857,7 @@ qemuDomainSetPerfEvents(virDomainPtr dom,
VIR_PERF_PARAM_BRANCH_MISSES, 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_BUS_CYCLES, VIR_TYPED_PARAM_BOOLEAN,
VIR_PERF_PARAM_STALLED_CYCLES_FRONTEND, 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) NULL) < 0)
return -1; return -1;

View File

@ -42,7 +42,8 @@ VIR_ENUM_IMPL(virPerfEvent, VIR_PERF_EVENT_LAST,
"cpu_cycles", "instructions", "cpu_cycles", "instructions",
"cache_references", "cache_misses", "cache_references", "cache_misses",
"branch_instructions", "branch_misses", "branch_instructions", "branch_misses",
"bus_cycles", "stalled_cycles_frontend"); "bus_cycles", "stalled_cycles_frontend",
"stalled_cycles_backend");
struct virPerfEvent { struct virPerfEvent {
int type; int type;
@ -99,6 +100,9 @@ static struct virPerfEventAttr attrs[] = {
{.type = VIR_PERF_EVENT_STALLED_CYCLES_FRONTEND, {.type = VIR_PERF_EVENT_STALLED_CYCLES_FRONTEND,
.attrType = PERF_TYPE_HARDWARE, .attrType = PERF_TYPE_HARDWARE,
.attrConfig = PERF_COUNT_HW_STALLED_CYCLES_FRONTEND}, .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; typedef struct virPerfEventAttr *virPerfEventAttrPtr;

View File

@ -43,6 +43,9 @@ typedef enum {
VIR_PERF_EVENT_STALLED_CYCLES_FRONTEND, /* Count of stalled cpu cycles in VIR_PERF_EVENT_STALLED_CYCLES_FRONTEND, /* Count of stalled cpu cycles in
the frontend of the instruction the frontend of the instruction
processor pipeline */ 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 VIR_PERF_EVENT_LAST
} virPerfEventType; } virPerfEventType;

View File

@ -24,6 +24,7 @@
<event name='branch_misses' enabled='yes'/> <event name='branch_misses' enabled='yes'/>
<event name='bus_cycles' enabled='yes'/> <event name='bus_cycles' enabled='yes'/>
<event name='stalled_cycles_frontend' enabled='yes'/> <event name='stalled_cycles_frontend' enabled='yes'/>
<event name='stalled_cycles_backend' enabled='yes'/>
</perf> </perf>
<devices> <devices>
</devices> </devices>

View 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_instructions" - the count of branch instructions,
"perf.branch_misses" - the count of branch misses, "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 "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. 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 cycles in the frontend of the
instruction processor pipeline by instruction processor pipeline by
applications running on the platform. 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 B<Note>: The statistics can be retrieved using the B<domstats> command using
the I<--perf> flag. the I<--perf> flag.