perf: add emulation_faults software perf event support

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

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
This commit is contained in:
Nitesh Konkar 2017-02-23 20:25:38 +05:30 committed by John Ferlan
parent 6780791f18
commit 0265bbeee3
9 changed files with 33 additions and 1 deletions

View File

@ -1955,6 +1955,7 @@
&lt;event name='page_faults_min' enabled='no'/&gt; &lt;event name='page_faults_min' enabled='no'/&gt;
&lt;event name='page_faults_maj' enabled='no'/&gt; &lt;event name='page_faults_maj' enabled='no'/&gt;
&lt;event name='alignment_faults' enabled='no'/&gt; &lt;event name='alignment_faults' enabled='no'/&gt;
&lt;event name='emulation_faults' enabled='no'/&gt;
&lt;/perf&gt; &lt;/perf&gt;
... ...
</pre> </pre>
@ -2090,6 +2091,14 @@
applications running on the platform</td> applications running on the platform</td>
<td><code>perf.alignment_faults</code></td> <td><code>perf.alignment_faults</code></td>
</tr> </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> </table>
<h3><a name="elementsDevices">Devices</a></h3> <h3><a name="elementsDevices">Devices</a></h3>

View File

@ -441,6 +441,7 @@
<value>page_faults_min</value> <value>page_faults_min</value>
<value>page_faults_maj</value> <value>page_faults_maj</value>
<value>alignment_faults</value> <value>alignment_faults</value>
<value>emulation_faults</value>
</choice> </choice>
</attribute> </attribute>
<attribute name="enabled"> <attribute name="enabled">

View File

@ -2270,6 +2270,16 @@ void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats);
*/ */
# define VIR_PERF_PARAM_ALIGNMENT_FAULTS "alignment_faults" # 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, int virDomainGetPerfEvents(virDomainPtr dom,
virTypedParameterPtr *params, virTypedParameterPtr *params,
int *nparams, int *nparams,

View File

@ -11272,6 +11272,9 @@ virConnectGetDomainCapabilities(virConnectPtr conn,
* "perf.alignment_faults" - The count of alignment faults as unsigned * "perf.alignment_faults" - The count of alignment faults as unsigned
* long long. It is produced by the * long long. It is produced by the
* alignment_faults perf event * 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 * 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

@ -9575,6 +9575,7 @@ qemuDomainSetPerfEvents(virDomainPtr dom,
VIR_PERF_PARAM_PAGE_FAULTS_MIN, VIR_TYPED_PARAM_BOOLEAN, VIR_PERF_PARAM_PAGE_FAULTS_MIN, VIR_TYPED_PARAM_BOOLEAN,
VIR_PERF_PARAM_PAGE_FAULTS_MAJ, 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_ALIGNMENT_FAULTS, VIR_TYPED_PARAM_BOOLEAN,
VIR_PERF_PARAM_EMULATION_FAULTS, VIR_TYPED_PARAM_BOOLEAN,
NULL) < 0) NULL) < 0)
return -1; return -1;

View File

@ -47,7 +47,7 @@ VIR_ENUM_IMPL(virPerfEvent, VIR_PERF_EVENT_LAST,
"cpu_clock", "task_clock", "page_faults", "cpu_clock", "task_clock", "page_faults",
"context_switches", "cpu_migrations", "context_switches", "cpu_migrations",
"page_faults_min", "page_faults_maj", "page_faults_min", "page_faults_maj",
"alignment_faults"); "alignment_faults", "emulation_faults");
struct virPerfEvent { struct virPerfEvent {
int type; int type;
@ -140,6 +140,9 @@ static struct virPerfEventAttr attrs[] = {
{.type = VIR_PERF_EVENT_ALIGNMENT_FAULTS, {.type = VIR_PERF_EVENT_ALIGNMENT_FAULTS,
.attrType = PERF_TYPE_SOFTWARE, .attrType = PERF_TYPE_SOFTWARE,
.attrConfig = PERF_COUNT_SW_ALIGNMENT_FAULTS}, .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; typedef struct virPerfEventAttr *virPerfEventAttrPtr;

View File

@ -55,6 +55,7 @@ typedef enum {
VIR_PERF_EVENT_PAGE_FAULTS_MIN, /* Count of minor page faults */ 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_PAGE_FAULTS_MAJ, /* Count of major page faults */
VIR_PERF_EVENT_ALIGNMENT_FAULTS, /* Count of alignment faults */ VIR_PERF_EVENT_ALIGNMENT_FAULTS, /* Count of alignment faults */
VIR_PERF_EVENT_EMULATION_FAULTS, /* Count of emulation faults */
VIR_PERF_EVENT_LAST VIR_PERF_EVENT_LAST
} virPerfEventType; } virPerfEventType;

View File

@ -34,6 +34,7 @@
<event name='page_faults_min' enabled='yes'/> <event name='page_faults_min' enabled='yes'/>
<event name='page_faults_maj' enabled='yes'/> <event name='page_faults_maj' enabled='yes'/>
<event name='alignment_faults' enabled='yes'/> <event name='alignment_faults' enabled='yes'/>
<event name='emulation_faults' enabled='yes'/>
</perf> </perf>
<devices> <devices>
</devices> </devices>

View 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_min" - the count of minor page faults
"perf.page_faults_maj" - the count of major page faults "perf.page_faults_maj" - the count of major page faults
"perf.alignment_faults" - the count of alignment 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. 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. by applications running on the platform.
alignment_faults - Provides the count alignment faults alignment_faults - Provides the count alignment faults
by applications running on the platform. 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 B<Note>: The statistics can be retrieved using the B<domstats> command using
the I<--perf> flag. the I<--perf> flag.