[libvirt] [PATCH 1/1] perf: add more perf events support

With current perf framework, this patch adds support to more perf events, including cache missing, cache peference, cpu cycles, instrction, etc.. Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com> --- include/libvirt/libvirt-domain.h | 39 ++++++++++++++++++++++++ src/libvirt-domain.c | 8 +++++ src/qemu/qemu_driver.c | 23 +++++++------- src/util/virperf.c | 65 +++++++++++++++++++++++++++++++++++++++- src/util/virperf.h | 4 +++ 5 files changed, 126 insertions(+), 13 deletions(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index cba4fa5..99c4c48 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1928,6 +1928,45 @@ void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats); */ # define VIR_PERF_PARAM_MBML "mbml" +/** + * VIR_PERF_PARAM_CACHE_MISSES: + * + * Macro for typed parameter name that represents cache_misses perf + * event which can be used to measure the amount of cache missing by + * applications running on the platform. It corresponds to the + * "perf.cache_misses" field in the *Stats APIs. + */ +# define VIR_PERF_PARAM_CACHE_MISSES "cache_misses" + +/** + * VIR_PERF_PARAM_CACHE_REFERENCES: + * + * Macro for typed parameter name that represents cache_peferences + * perf event which can be used to measure the amount of cache hit + * by applications running on the platform. It corresponds to the + * "perf.cache_peferences" field in the *Stats APIs. + */ +# define VIR_PERF_PARAM_CACHE_REFERENCES "cache_peferences" + +/** + * VIR_PERF_PARAM_INSTRUCTIONS: + * + * Macro for typed parameter name that represents instructions perf + * event which can be used to measure the amount of instructions + * by applications running on the platform. It corresponds to the + * "perf.instructions" field in the *Stats APIs. + */ +# define VIR_PERF_PARAM_INSTRUCTIONS "instructions" + +/** + * VIR_PERF_PARAM_CPU_CYCLES: + * + * Macro for typed parameter name that represents cpu_cycles perf event + * which can be used to measure how many cycles one instruction needs. + * It corresponds to the "perf.cpu_cycles" field in the *Stats APIs. + */ +# define VIR_PERF_PARAM_CPU_CYCLES "cpu_cycles" + int virDomainGetPerfEvents(virDomainPtr dom, virTypedParameterPtr *params, int *nparams, diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 73ae369..ef71b31 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -11452,6 +11452,14 @@ virConnectGetDomainCapabilities(virConnectPtr conn, * "perf.mbml" - the amount of data (bytes/s) sent through the memory controller * on the socket as unsigned long long. It is produced by mbml * perf event. + * "perf.cache_misses" - the amount of cache missing as unsigned long long. + * It is produced by cache_misses perf event. + * "perf.cache_peferences" - the amount of cache hit as unsigned long long. + * It is produced by cache_peferences perf event. + * "perf.instructions" - the amount of instructions as unsigned long long. + * It is produced by instructions perf event. + * "perf.cpu_cycles" - the amount of cycles one instruction needs as unsigned + * long long. It is produced by cpu_cycles 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 10d3e3d..d465ec5 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9756,6 +9756,10 @@ qemuDomainSetPerfEvents(virDomainPtr dom, VIR_PERF_PARAM_CMT, VIR_TYPED_PARAM_BOOLEAN, VIR_PERF_PARAM_MBMT, VIR_TYPED_PARAM_BOOLEAN, VIR_PERF_PARAM_MBML, VIR_TYPED_PARAM_BOOLEAN, + VIR_PERF_PARAM_CACHE_MISSES, VIR_TYPED_PARAM_BOOLEAN, + VIR_PERF_PARAM_CACHE_REFERENCES, VIR_TYPED_PARAM_BOOLEAN, + VIR_PERF_PARAM_INSTRUCTIONS, VIR_TYPED_PARAM_BOOLEAN, + VIR_PERF_PARAM_CPU_CYCLES, VIR_TYPED_PARAM_BOOLEAN, NULL) < 0) return -1; @@ -19071,10 +19075,10 @@ qemuDomainGetStatsBlock(virQEMUDriverPtr driver, #undef QEMU_ADD_COUNT_PARAM static int -qemuDomainGetStatsPerfRdt(virPerfPtr perf, - virPerfEventType type, - virDomainStatsRecordPtr record, - int *maxparams) +qemuDomainGetStatsPerfOneEvent(virPerfPtr perf, + virPerfEventType type, + virDomainStatsRecordPtr record, + int *maxparams) { char param_name[VIR_TYPED_PARAM_FIELD_LENGTH]; uint64_t value = 0; @@ -19110,14 +19114,9 @@ qemuDomainGetStatsPerf(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, if (!virPerfEventIsEnabled(priv->perf, i)) continue; - switch (i) { - case VIR_PERF_EVENT_CMT: - case VIR_PERF_EVENT_MBMT: - case VIR_PERF_EVENT_MBML: - if (qemuDomainGetStatsPerfRdt(priv->perf, i, record, maxparams) < 0) - goto cleanup; - break; - } + if (qemuDomainGetStatsPerfOneEvent(priv->perf, i, + record, maxparams) < 0) + goto cleanup; } ret = 0; diff --git a/src/util/virperf.c b/src/util/virperf.c index 450b3ba..38f2158 100644 --- a/src/util/virperf.c +++ b/src/util/virperf.c @@ -38,7 +38,9 @@ VIR_LOG_INIT("util.perf"); #define VIR_FROM_THIS VIR_FROM_PERF VIR_ENUM_IMPL(virPerfEvent, VIR_PERF_EVENT_LAST, - "cmt", "mbmt", "mbml"); + "cmt", "mbmt", "mbml", + "cache_misses", "cache_peferences", + "instructions", "cpu_cycles"); struct virPerfEvent { int type; @@ -186,6 +188,60 @@ virPerfRdtEnable(virPerfEventPtr event, return -1; } +static int +virPerfGeneralEnable(virPerfEventPtr event, + pid_t pid) +{ + struct perf_event_attr attr; + + memset(&attr, 0, sizeof(attr)); + attr.size = sizeof(attr); + attr.inherit = 1; + attr.disabled = 1; + attr.enable_on_exec = 0; + + switch (event->type) { + case VIR_PERF_EVENT_CACHE_MISSES: + attr.type = PERF_TYPE_HARDWARE; + attr.config = PERF_COUNT_HW_CACHE_MISSES; + break; + case VIR_PERF_EVENT_CACHE_REFERENCES: + attr.type = PERF_TYPE_HARDWARE; + attr.config = PERF_COUNT_HW_CACHE_REFERENCES; + break; + case VIR_PERF_EVENT_INSTRUCTIONS: + attr.type = PERF_TYPE_HARDWARE; + attr.config = PERF_COUNT_HW_INSTRUCTIONS; + break; + case VIR_PERF_EVENT_CPU_CYCLES: + attr.type = PERF_TYPE_HARDWARE; + attr.config = PERF_COUNT_HW_CPU_CYCLES; + break; + } + + event->fd = syscall(__NR_perf_event_open, &attr, pid, -1, -1, 0); + if (event->fd < 0) { + virReportSystemError(errno, + _("Unable to open perf event for %s"), + virPerfEventTypeToString(event->type)); + goto error; + } + + if (ioctl(event->fd, PERF_EVENT_IOC_ENABLE) < 0) { + virReportSystemError(errno, + _("Unable to enable perf event for %s"), + virPerfEventTypeToString(event->type)); + goto error; + } + + event->enabled = true; + return 0; + + error: + VIR_FORCE_CLOSE(event->fd); + return -1; +} + int virPerfEventEnable(virPerfPtr perf, virPerfEventType type, @@ -202,6 +258,13 @@ virPerfEventEnable(virPerfPtr perf, if (virPerfRdtEnable(event, pid) < 0) return -1; break; + case VIR_PERF_EVENT_CACHE_MISSES: + case VIR_PERF_EVENT_CACHE_REFERENCES: + case VIR_PERF_EVENT_INSTRUCTIONS: + case VIR_PERF_EVENT_CPU_CYCLES: + if (virPerfGeneralEnable(event, pid) < 0) + return -1; + break; case VIR_PERF_EVENT_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, _("Unexpected perf event type=%d"), type); diff --git a/src/util/virperf.h b/src/util/virperf.h index 769e85a..2cab339 100644 --- a/src/util/virperf.h +++ b/src/util/virperf.h @@ -28,6 +28,10 @@ typedef enum { VIR_PERF_EVENT_CMT, VIR_PERF_EVENT_MBMT, VIR_PERF_EVENT_MBML, + VIR_PERF_EVENT_CACHE_MISSES, + VIR_PERF_EVENT_CACHE_REFERENCES, + VIR_PERF_EVENT_INSTRUCTIONS, + VIR_PERF_EVENT_CPU_CYCLES, VIR_PERF_EVENT_LAST } virPerfEventType; -- 1.9.1

Hi Peter, Do you have any comments on this patch? Thanks, Qiaowei
-----Original Message----- From: Ren, Qiaowei Sent: Tuesday, May 31, 2016 10:48 AM To: libvir-list@redhat.com Cc: Daniel P. Berrange <berrange@redhat.com>; Peter Krempa <pkrempa@redhat.com>; Ren, Qiaowei <qiaowei.ren@intel.com> Subject: [PATCH 1/1] perf: add more perf events support
With current perf framework, this patch adds support to more perf events, including cache missing, cache peference, cpu cycles, instrction, etc..
Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com> --- include/libvirt/libvirt-domain.h | 39 ++++++++++++++++++++++++ src/libvirt-domain.c | 8 +++++ src/qemu/qemu_driver.c | 23 +++++++------- src/util/virperf.c | 65 +++++++++++++++++++++++++++++++++++++++- src/util/virperf.h | 4 +++ 5 files changed, 126 insertions(+), 13 deletions(-)
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index cba4fa5..99c4c48 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1928,6 +1928,45 @@ void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats); */ # define VIR_PERF_PARAM_MBML "mbml"
+/** + * VIR_PERF_PARAM_CACHE_MISSES: + * + * Macro for typed parameter name that represents cache_misses perf + * event which can be used to measure the amount of cache missing by + * applications running on the platform. It corresponds to the + * "perf.cache_misses" field in the *Stats APIs. + */ +# define VIR_PERF_PARAM_CACHE_MISSES "cache_misses" + +/** + * VIR_PERF_PARAM_CACHE_REFERENCES: + * + * Macro for typed parameter name that represents cache_peferences + * perf event which can be used to measure the amount of cache hit + * by applications running on the platform. It corresponds to the + * "perf.cache_peferences" field in the *Stats APIs. + */ +# define VIR_PERF_PARAM_CACHE_REFERENCES "cache_peferences" + +/** + * VIR_PERF_PARAM_INSTRUCTIONS: + * + * Macro for typed parameter name that represents instructions perf + * event which can be used to measure the amount of instructions + * by applications running on the platform. It corresponds to the + * "perf.instructions" field in the *Stats APIs. + */ +# define VIR_PERF_PARAM_INSTRUCTIONS "instructions" + +/** + * VIR_PERF_PARAM_CPU_CYCLES: + * + * Macro for typed parameter name that represents cpu_cycles perf event + * which can be used to measure how many cycles one instruction needs. + * It corresponds to the "perf.cpu_cycles" field in the *Stats APIs. + */ +# define VIR_PERF_PARAM_CPU_CYCLES "cpu_cycles" + int virDomainGetPerfEvents(virDomainPtr dom, virTypedParameterPtr *params, int *nparams, diff --git a/src/libvirt-domain.c b/src/libvirt- domain.c index 73ae369..ef71b31 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -11452,6 +11452,14 @@ virConnectGetDomainCapabilities(virConnectPtr conn, * "perf.mbml" - the amount of data (bytes/s) sent through the memory controller * on the socket as unsigned long long. It is produced by mbml * perf event. + * "perf.cache_misses" - the amount of cache missing as unsigned long long. + * It is produced by cache_misses perf event. + * "perf.cache_peferences" - the amount of cache hit as unsigned long long. + * It is produced by cache_peferences perf event. + * "perf.instructions" - the amount of instructions as unsigned long long. + * It is produced by instructions perf event. + * "perf.cpu_cycles" - the amount of cycles one instruction needs as + unsigned + * long long. It is produced by cpu_cycles 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 10d3e3d..d465ec5 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9756,6 +9756,10 @@ qemuDomainSetPerfEvents(virDomainPtr dom, VIR_PERF_PARAM_CMT, VIR_TYPED_PARAM_BOOLEAN, VIR_PERF_PARAM_MBMT, VIR_TYPED_PARAM_BOOLEAN, VIR_PERF_PARAM_MBML, VIR_TYPED_PARAM_BOOLEAN, + VIR_PERF_PARAM_CACHE_MISSES, VIR_TYPED_PARAM_BOOLEAN, + VIR_PERF_PARAM_CACHE_REFERENCES, VIR_TYPED_PARAM_BOOLEAN, + VIR_PERF_PARAM_INSTRUCTIONS, VIR_TYPED_PARAM_BOOLEAN, + VIR_PERF_PARAM_CPU_CYCLES, + VIR_TYPED_PARAM_BOOLEAN, NULL) < 0) return -1;
@@ -19071,10 +19075,10 @@ qemuDomainGetStatsBlock(virQEMUDriverPtr driver, #undef QEMU_ADD_COUNT_PARAM
static int -qemuDomainGetStatsPerfRdt(virPerfPtr perf, - virPerfEventType type, - virDomainStatsRecordPtr record, - int *maxparams) +qemuDomainGetStatsPerfOneEvent(virPerfPtr perf, + virPerfEventType type, + virDomainStatsRecordPtr record, + int *maxparams) { char param_name[VIR_TYPED_PARAM_FIELD_LENGTH]; uint64_t value = 0; @@ -19110,14 +19114,9 @@ qemuDomainGetStatsPerf(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, if (!virPerfEventIsEnabled(priv->perf, i)) continue;
- switch (i) { - case VIR_PERF_EVENT_CMT: - case VIR_PERF_EVENT_MBMT: - case VIR_PERF_EVENT_MBML: - if (qemuDomainGetStatsPerfRdt(priv->perf, i, record, maxparams) < 0) - goto cleanup; - break; - } + if (qemuDomainGetStatsPerfOneEvent(priv->perf, i, + record, maxparams) < 0) + goto cleanup; }
ret = 0; diff --git a/src/util/virperf.c b/src/util/virperf.c index 450b3ba..38f2158 100644 --- a/src/util/virperf.c +++ b/src/util/virperf.c @@ -38,7 +38,9 @@ VIR_LOG_INIT("util.perf"); #define VIR_FROM_THIS VIR_FROM_PERF
VIR_ENUM_IMPL(virPerfEvent, VIR_PERF_EVENT_LAST, - "cmt", "mbmt", "mbml"); + "cmt", "mbmt", "mbml", + "cache_misses", "cache_peferences", + "instructions", "cpu_cycles");
struct virPerfEvent { int type; @@ -186,6 +188,60 @@ virPerfRdtEnable(virPerfEventPtr event, return -1; }
+static int +virPerfGeneralEnable(virPerfEventPtr event, + pid_t pid) +{ + struct perf_event_attr attr; + + memset(&attr, 0, sizeof(attr)); + attr.size = sizeof(attr); + attr.inherit = 1; + attr.disabled = 1; + attr.enable_on_exec = 0; + + switch (event->type) { + case VIR_PERF_EVENT_CACHE_MISSES: + attr.type = PERF_TYPE_HARDWARE; + attr.config = PERF_COUNT_HW_CACHE_MISSES; + break; + case VIR_PERF_EVENT_CACHE_REFERENCES: + attr.type = PERF_TYPE_HARDWARE; + attr.config = PERF_COUNT_HW_CACHE_REFERENCES; + break; + case VIR_PERF_EVENT_INSTRUCTIONS: + attr.type = PERF_TYPE_HARDWARE; + attr.config = PERF_COUNT_HW_INSTRUCTIONS; + break; + case VIR_PERF_EVENT_CPU_CYCLES: + attr.type = PERF_TYPE_HARDWARE; + attr.config = PERF_COUNT_HW_CPU_CYCLES; + break; + } + + event->fd = syscall(__NR_perf_event_open, &attr, pid, -1, -1, 0); + if (event->fd < 0) { + virReportSystemError(errno, + _("Unable to open perf event for %s"), + virPerfEventTypeToString(event->type)); + goto error; + } + + if (ioctl(event->fd, PERF_EVENT_IOC_ENABLE) < 0) { + virReportSystemError(errno, + _("Unable to enable perf event for %s"), + virPerfEventTypeToString(event->type)); + goto error; + } + + event->enabled = true; + return 0; + + error: + VIR_FORCE_CLOSE(event->fd); + return -1; +} + int virPerfEventEnable(virPerfPtr perf, virPerfEventType type, @@ -202,6 +258,13 @@ virPerfEventEnable(virPerfPtr perf, if (virPerfRdtEnable(event, pid) < 0) return -1; break; + case VIR_PERF_EVENT_CACHE_MISSES: + case VIR_PERF_EVENT_CACHE_REFERENCES: + case VIR_PERF_EVENT_INSTRUCTIONS: + case VIR_PERF_EVENT_CPU_CYCLES: + if (virPerfGeneralEnable(event, pid) < 0) + return -1; + break; case VIR_PERF_EVENT_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, _("Unexpected perf event type=%d"), type); diff --git a/src/util/virperf.h b/src/util/virperf.h index 769e85a..2cab339 100644 --- a/src/util/virperf.h +++ b/src/util/virperf.h @@ -28,6 +28,10 @@ typedef enum { VIR_PERF_EVENT_CMT, VIR_PERF_EVENT_MBMT, VIR_PERF_EVENT_MBML, + VIR_PERF_EVENT_CACHE_MISSES, + VIR_PERF_EVENT_CACHE_REFERENCES, + VIR_PERF_EVENT_INSTRUCTIONS, + VIR_PERF_EVENT_CPU_CYCLES,
VIR_PERF_EVENT_LAST } virPerfEventType; -- 1.9.1

On Tue, May 31, 2016 at 10:48:15 +0800, Qiaowei Ren wrote:
With current perf framework, this patch adds support to more perf events, including cache missing, cache peference, cpu cycles, instrction, etc..
Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com> --- include/libvirt/libvirt-domain.h | 39 ++++++++++++++++++++++++ src/libvirt-domain.c | 8 +++++ src/qemu/qemu_driver.c | 23 +++++++------- src/util/virperf.c | 65 +++++++++++++++++++++++++++++++++++++++- src/util/virperf.h | 4 +++ 5 files changed, 126 insertions(+), 13 deletions(-)
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index cba4fa5..99c4c48 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1928,6 +1928,45 @@ void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats); */ # define VIR_PERF_PARAM_MBML "mbml"
[...]
+/** + * VIR_PERF_PARAM_INSTRUCTIONS: + * + * Macro for typed parameter name that represents instructions perf + * event which can be used to measure the amount of instructions + * by applications running on the platform. It corresponds to the + * "perf.instructions" field in the *Stats APIs.
I'm not sure if I understand the implications and usability of this stat parameter. Could you elaborate on how this can be used?
+ */ +# define VIR_PERF_PARAM_INSTRUCTIONS "instructions" + +/** + * VIR_PERF_PARAM_CPU_CYCLES: + * + * Macro for typed parameter name that represents cpu_cycles perf event + * which can be used to measure how many cycles one instruction needs. + * It corresponds to the "perf.cpu_cycles" field in the *Stats APIs.
And same for this. I don't really see how this can be used.
+ */ +# define VIR_PERF_PARAM_CPU_CYCLES "cpu_cycles" +
The rest of this patch looks good and applies cleanly. Peter

-----Original Message----- From: Peter Krempa [mailto:pkrempa@redhat.com] Sent: Thursday, June 9, 2016 7:50 PM To: Ren, Qiaowei <qiaowei.ren@intel.com> Cc: libvir-list@redhat.com Subject: Re: [libvirt] [PATCH 1/1] perf: add more perf events support
On Tue, May 31, 2016 at 10:48:15 +0800, Qiaowei Ren wrote:
With current perf framework, this patch adds support to more perf events, including cache missing, cache peference, cpu cycles, instrction, etc..
Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com> --- include/libvirt/libvirt-domain.h | 39 ++++++++++++++++++++++++ src/libvirt-domain.c | 8 +++++ src/qemu/qemu_driver.c | 23 +++++++------- src/util/virperf.c | 65 +++++++++++++++++++++++++++++++++++++++- src/util/virperf.h | 4 +++ 5 files changed, 126 insertions(+), 13 deletions(-)
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index cba4fa5..99c4c48 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1928,6 +1928,45 @@ void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats); */ # define VIR_PERF_PARAM_MBML "mbml"
[...]
+/** + * VIR_PERF_PARAM_INSTRUCTIONS: + * + * Macro for typed parameter name that represents instructions perf + * event which can be used to measure the amount of instructions + * by applications running on the platform. It corresponds to the + * "perf.instructions" field in the *Stats APIs.
I'm not sure if I understand the implications and usability of this stat parameter. Could you elaborate on how this can be used?
+ */ +# define VIR_PERF_PARAM_INSTRUCTIONS "instructions" + +/** + * VIR_PERF_PARAM_CPU_CYCLES: + * + * Macro for typed parameter name that represents cpu_cycles perf +event + * which can be used to measure how many cycles one instruction needs. + * It corresponds to the "perf.cpu_cycles" field in the *Stats APIs.
And same for this. I don't really see how this can be used.
Peter, thanks for your feedback! Instructions and cycles can be used to gain IPC (Instructions Per Clock, = Instructions/Cycles), and a low IPC ratio indicates the code of the process makes poor use of the CPU. Thanks, Qiaowei

-----Original Message----- From: libvir-list-bounces@redhat.com [mailto:libvir-list-bounces@redhat.com] On Behalf Of Ren, Qiaowei Sent: Sunday, June 12, 2016 10:14 AM To: Peter Krempa <pkrempa@redhat.com> Cc: libvir-list@redhat.com Subject: Re: [libvirt] [PATCH 1/1] perf: add more perf events support
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index cba4fa5..99c4c48 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1928,6 +1928,45 @@ void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats); */ # define VIR_PERF_PARAM_MBML "mbml"
[...]
+/** + * VIR_PERF_PARAM_INSTRUCTIONS: + * + * Macro for typed parameter name that represents instructions perf + * event which can be used to measure the amount of instructions + * by applications running on the platform. It corresponds to the + * "perf.instructions" field in the *Stats APIs.
I'm not sure if I understand the implications and usability of this stat parameter. Could you elaborate on how this can be used?
+ */ +# define VIR_PERF_PARAM_INSTRUCTIONS "instructions" + +/** + * VIR_PERF_PARAM_CPU_CYCLES: + * + * Macro for typed parameter name that represents cpu_cycles perf +event + * which can be used to measure how many cycles one instruction needs. + * It corresponds to the "perf.cpu_cycles" field in the *Stats APIs.
And same for this. I don't really see how this can be used.
Peter, thanks for your feedback!
Instructions and cycles can be used to gain IPC (Instructions Per Clock, = Instructions/Cycles), and a low IPC ratio indicates the code of the process makes poor use of the CPU.
Peter, do you have any other comments about this patch? Thanks, Qiaowei

On Tue, Jun 21, 2016 at 01:43:30 +0000, Ren, Qiaowei wrote:
-----Original Message----- From: libvir-list-bounces@redhat.com [mailto:libvir-list-bounces@redhat.com] On Behalf Of Ren, Qiaowei Sent: Sunday, June 12, 2016 10:14 AM To: Peter Krempa <pkrempa@redhat.com> Cc: libvir-list@redhat.com Subject: Re: [libvirt] [PATCH 1/1] perf: add more perf events support
[...]
Peter, do you have any other comments about this patch?
Please see my recent patch: https://www.redhat.com/archives/libvir-list/2016-June/msg00995.html where I've added some documentation of the XML and fixed the schema and added a test that actually is used with the parser since the parser was broken. You'll need to add the relevant bits to the files added by those commits. Additionally I'd be glad if you could improve the documentation in the XML. Peter

-----Original Message----- From: Peter Krempa [mailto:pkrempa@redhat.com] Sent: Tuesday, June 21, 2016 3:03 PM To: Ren, Qiaowei <qiaowei.ren@intel.com> Cc: libvir-list@redhat.com Subject: Re: [libvirt] [PATCH 1/1] perf: add more perf events support
On Tue, Jun 21, 2016 at 01:43:30 +0000, Ren, Qiaowei wrote:
-----Original Message----- From: libvir-list-bounces@redhat.com [mailto:libvir-list-bounces@redhat.com] On Behalf Of Ren, Qiaowei Sent: Sunday, June 12, 2016 10:14 AM To: Peter Krempa <pkrempa@redhat.com> Cc: libvir-list@redhat.com Subject: Re: [libvirt] [PATCH 1/1] perf: add more perf events support
[...]
Peter, do you have any other comments about this patch?
Please see my recent patch: https://www.redhat.com/archives/libvir-list/2016-June/msg00995.html
where I've added some documentation of the XML and fixed the schema and added a test that actually is used with the parser since the parser was broken. You'll need to add the relevant bits to the files added by those commits.
Additionally I'd be glad if you could improve the documentation in the XML.
Ok. I will update the XML documentation in next version. Thanks, Qiaowei
participants (3)
-
Peter Krempa
-
Qiaowei Ren
-
Ren, Qiaowei