[PATCH] perf: Prevent enabling of already enabled perf event

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

 



Currently, on every --enable perf_event command,
a new event->fd is created and counting of perf
event counter starts from zero and previous
event->fd is lost. This patch prevents this
behaviour.

Signed-off-by: Nitesh Konkar <nitkon12@xxxxxxxxxxxxxxxxxx>
---
 src/util/virperf.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/util/virperf.c b/src/util/virperf.c
index 788b817..57c2081 100644
--- a/src/util/virperf.c
+++ b/src/util/virperf.c
@@ -230,6 +230,9 @@ virPerfEventEnable(virPerfPtr perf,
     if (!event || !event_attr)
         return -1;
 
+    if (event->enabled)
+        return 0;
+
     if (event_attr->attrType == 0 && (type == VIR_PERF_EVENT_CMT ||
                                        type == VIR_PERF_EVENT_MBMT ||
                                        type == VIR_PERF_EVENT_MBML)) {
-- 
1.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