diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index c6c2d2c7db..357cb2d1e3 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1931,6 +1931,7 @@
<event name='branch_misses' enabled='no'/>
<event name='bus_cycles' enabled='no'/>
<event name='stalled_cycles_frontend' enabled='no'/>
+ <event name='stalled_cycles_backend' enabled='no'/>
</perf>
...
@@ -1997,6 +1998,12 @@
processor pipeline by applications running on the platform
perf.stalled_cycles_frontend |
+
+ stalled_cycles_backend |
+ the count of stalled cpu cycles in the backend of the instruction
+ processor pipeline by applications running on the platform |
+ perf.stalled_cycles_backend |
+
diff --git a/docs/news.html.in b/docs/news.html.in
index 52ac51d863..c148f336f4 100644
--- a/docs/news.html.in
+++ b/docs/news.html.in
@@ -36,8 +36,9 @@
- perf: Add more perf statistics
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
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 9ce7cc9db2..e5b5fb5c7b 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -431,6 +431,7 @@
branch_misses
bus_cycles
stalled_cycles_frontend
+ stalled_cycles_backend
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 8d608ddb3f..ad9eef3573 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -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,
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index c438921adf..d40760963f 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -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
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 45f8d56234..140a785fa0 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -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;
diff --git a/src/util/virperf.c b/src/util/virperf.c
index c21147a845..c9a0e39483 100644
--- a/src/util/virperf.c
+++ b/src/util/virperf.c
@@ -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;
diff --git a/src/util/virperf.h b/src/util/virperf.h
index a1ba399171..e5b9ae850c 100644
--- a/src/util/virperf.h
+++ b/src/util/virperf.h
@@ -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;
diff --git a/tests/genericxml2xmlindata/generic-perf.xml b/tests/genericxml2xmlindata/generic-perf.xml
index db7684327c..f01d574e6f 100644
--- a/tests/genericxml2xmlindata/generic-perf.xml
+++ b/tests/genericxml2xmlindata/generic-perf.xml
@@ -24,6 +24,7 @@
+
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 1a45b529dc..fb0758dfa0 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -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 command for more details about each event.
@@ -2307,6 +2308,10 @@ B
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: The statistics can be retrieved using the B command using
the I<--perf> flag.