diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index cd3182bb6f40d7580c936d6e6f86d20034c1b6b7..c6c2d2c7db726c28abc34a76b76abf6b860e94dc 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1930,6 +1930,7 @@
<event name='branch_instructions' enabled='no'/>
<event name='branch_misses' enabled='no'/>
<event name='bus_cycles' enabled='no'/>
+ <event name='stalled_cycles_frontend' enabled='no'/>
</perf>
...
@@ -1990,6 +1991,12 @@
the count of bus cycles by applications running on the platform |
perf.bus_cycles |
+
+ stalled_cycles_frontend |
+ the count of stalled cpu cycles in the frontend of the instruction
+ processor pipeline by applications running on the platform |
+ perf.stalled_cycles_frontend |
+
diff --git a/docs/news.html.in b/docs/news.html.in
index 09e4c9544ac2870aca5d3101bd4c0115108a8f3e..52ac51d863b1cfc84125b36bcc487f31fb9651d2 100644
--- a/docs/news.html.in
+++ b/docs/news.html.in
@@ -35,9 +35,9 @@
Improvements
- perf: Add more perf statistics
- 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
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 21a7afa47fd450f609b378bb909fc75bbf6a9df7..9ce7cc9db29cd4356d39d9acba5a9a655c7941e3 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -430,6 +430,7 @@
branch_instructions
branch_misses
bus_cycles
+ stalled_cycles_frontend
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 6d74238bbd2c4928fccf69cfb3c161e860e9f878..8d608ddb3fe5841a0c7071fb702c5bed47f5d5f3 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -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,
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 821801126706c6c59ad391cf8bf7925a5d341e8f..c438921adfa08125e99b02abc3e27bb6d8c3a931 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -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
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ee99d6f805bf2a4f3573bff00571b2b48dc89920..45f8d562341928f4fb778d7fd909f68a88a87696 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -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;
diff --git a/src/util/virperf.c b/src/util/virperf.c
index 31a55859651d3632e9744029cc69a2ed8f14f533..c21147a84522780d4f79223e5a8832454b54309f 100644
--- a/src/util/virperf.c
+++ b/src/util/virperf.c
@@ -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;
diff --git a/src/util/virperf.h b/src/util/virperf.h
index ac6d7895186b7d46969b65f0c3a50d10ec2fee20..a1ba3991714e32588320c1a6cc1c6a72c26dff0c 100644
--- a/src/util/virperf.h
+++ b/src/util/virperf.h
@@ -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;
diff --git a/tests/genericxml2xmlindata/generic-perf.xml b/tests/genericxml2xmlindata/generic-perf.xml
index 56a6173796bde9409623c58388098e0d1a499974..db7684327c3ace50c7f0168e28426abeccc93ef9 100644
--- a/tests/genericxml2xmlindata/generic-perf.xml
+++ b/tests/genericxml2xmlindata/generic-perf.xml
@@ -23,6 +23,7 @@
+
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 7b3cb74cb41c14dfde41ac7a17cc995c25c382f1..1a45b529dc50ccc661d742498899f11c3166fdff 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -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 command for more details about each event.
@@ -2302,6 +2303,10 @@ B
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: The statistics can be retrieved using the B command using
the I<--perf> flag.