[PATCH] Make use of PERF_COUNT_HW_REF_CPU_CYCLES conditional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The PERF_COUNT_HW_REF_CPU_CYCLES constant is not available
on all Linux distros libvirt targets, so its use must be
made conditional. Other constant have existed long enough
that we can assume they exist, as we don't support very
old distros like RHEL-5 any more.

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 src/util/virperf.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/util/virperf.c b/src/util/virperf.c
index 49ec258..f64692b 100644
--- a/src/util/virperf.c
+++ b/src/util/virperf.c
@@ -104,8 +104,14 @@ static struct virPerfEventAttr attrs[] = {
      .attrType = PERF_TYPE_HARDWARE,
      .attrConfig = PERF_COUNT_HW_STALLED_CYCLES_BACKEND},
     {.type = VIR_PERF_EVENT_REF_CPU_CYCLES,
+# ifdef PERF_COUNT_HW_REF_CPU_CYCLES
      .attrType = PERF_TYPE_HARDWARE,
-     .attrConfig = PERF_COUNT_HW_REF_CPU_CYCLES},
+     .attrConfig = PERF_COUNT_HW_REF_CPU_CYCLES
+# else
+     .attrType = 0,
+     .attrConfig = 0,
+# endif
+    },
 };
 typedef struct virPerfEventAttr *virPerfEventAttrPtr;
 
-- 
2.9.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux