[PATCH go v2] Add support for perf events

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

 



Signed-off-by: Nitesh Konkar <nitkon12@xxxxxxxxxxxxxxxxxx>
---
 connect.go      | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 domain.go       | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 domain_compat.h | 36 ++++++++++++++++++++++++++++++++++++
 3 files changed, 144 insertions(+)

diff --git a/connect.go b/connect.go
index 3c53485..e24cf66 100644
--- a/connect.go
+++ b/connect.go
@@ -2264,6 +2264,24 @@ type DomainStatsPerf struct {
 	StalledCyclesBackend     uint64
 	RefCpuCyclesSet          bool
 	RefCpuCycles             uint64
+        CpuClockSet              bool
+        CpuClock                 uint64
+        TaskClockSet             bool
+        TaskClock                uint64
+        PageFaultsSet            bool
+        PageFaults               uint64
+        ContextSwitchesSet       bool
+        ContextSwitches          uint64
+        CpuMigrationsSet         bool
+        CpuMigrations            uint64
+        PageFaultsMinSet         bool
+        PageFaultsMin            uint64
+        PageFaultsMajSet         bool
+        PageFaultsMaj            uint64
+        AlignmentFaultsSet       bool
+        AlignmentFaults          uint64
+        EmulationFaultsSet       bool
+        EmulationFaults          uint64
 }
 
 func getDomainStatsPerfFieldInfo(params *DomainStatsPerf) map[string]typedParamsFieldInfo {
@@ -2320,6 +2338,42 @@ func getDomainStatsPerfFieldInfo(params *DomainStatsPerf) map[string]typedParams
 			set: &params.RefCpuCyclesSet,
 			ul:  &params.RefCpuCycles,
 		},
+                "perf.cpu_clock": typedParamsFieldInfo{
+                        set: &params.CpuClockSet,
+                        ul:  &params.CpuClock,
+                },
+                "perf.task_clock": typedParamsFieldInfo{
+                        set: &params.TaskClockSet,
+                        ul:  &params.TaskClock,
+                },
+                "perf.page_faults": typedParamsFieldInfo{
+                        set: &params.PageFaultsSet,
+                        ul:  &params.PageFaults,
+                },
+                "perf.context_switches": typedParamsFieldInfo{
+                        set: &params.ContextSwitchesSet,
+                        ul:  &params.ContextSwitches,
+                },
+                "perf.cpu_migrations": typedParamsFieldInfo{
+                        set: &params.CpuMigrationsSet,
+                        ul:  &params.CpuMigrations,
+                },
+                "perf.page_faults_min": typedParamsFieldInfo{
+                        set: &params.PageFaultsMinSet,
+                        ul:  &params.PageFaultsMin,
+                },
+                "perf.page_faults_maj": typedParamsFieldInfo{
+                        set: &params.PageFaultsMajSet,
+                        ul:  &params.PageFaultsMaj,
+                },
+                "perf.alignment_faults": typedParamsFieldInfo{
+                        set: &params.AlignmentFaultsSet,
+                        ul:  &params.AlignmentFaults,
+                },
+                "perf.emulation_faults": typedParamsFieldInfo{
+                        set: &params.EmulationFaultsSet,
+                        ul:  &params.EmulationFaults,
+                },
 	}
 }
 
diff --git a/domain.go b/domain.go
index 2bd9852..1cb0b95 100644
--- a/domain.go
+++ b/domain.go
@@ -3195,6 +3195,24 @@ type DomainPerfEvents struct {
 	StalledCyclesBackend     bool
 	RefCpuCyclesSet          bool
 	RefCpuCycles             bool
+        CpuClockSet              bool
+        CpuClock                 bool
+        TaskClockSet             bool
+        TaskClock                bool
+        PageFaultsSet            bool
+        PageFaults               bool
+        ContextSwitchesSet       bool
+        ContextSwitches          bool
+        CpuMigrationsSet         bool
+        CpuMigrations            bool
+        PageFaultsMinSet         bool
+        PageFaultsMin            bool
+        PageFaultsMajSet         bool
+        PageFaultsMaj            bool
+        AlignmentFaultsSet       bool
+        AlignmentFaults          bool
+        EmulationFaultsSet       bool
+        EmulationFaults          bool
 }
 
 /* Remember to also update DomainStatsPerf in connect.go when adding to the stuct above */
@@ -3253,6 +3271,42 @@ func getDomainPerfEventsFieldInfo(params *DomainPerfEvents) map[string]typedPara
 			set: &params.RefCpuCyclesSet,
 			b:   &params.RefCpuCycles,
 		},
+                C.VIR_PERF_PARAM_CPU_CLOCK: typedParamsFieldInfo{
+                        set: &params.CpuClockSet,
+                        b:   &params.CpuClock,
+                },
+                C.VIR_PERF_PARAM_TASK_CLOCK: typedParamsFieldInfo{
+                        set: &params.TaskClockSet,
+                        b:   &params.TaskClock,
+                },
+                C.VIR_PERF_PARAM_PAGE_FAULTS: typedParamsFieldInfo{
+                        set: &params.PageFaultsSet,
+                        b:   &params.PageFaults,
+                },
+                C.VIR_PERF_PARAM_CONTEXT_SWITCHES: typedParamsFieldInfo{
+                        set: &params.ContextSwitchesSet,
+                        b:   &params.ContextSwitches,
+                },
+                C.VIR_PERF_PARAM_CPU_MIGRATIONS: typedParamsFieldInfo{
+                        set: &params.CpuMigrationsSet,
+                        b:   &params.CpuMigrations,
+                },
+                C.VIR_PERF_PARAM_PAGE_FAULTS_MIN: typedParamsFieldInfo{
+                        set: &params.PageFaultsMinSet,
+                        b:   &params.PageFaultsMin,
+                },
+                C.VIR_PERF_PARAM_PAGE_FAULTS_MAJ: typedParamsFieldInfo{
+                        set: &params.PageFaultsMajSet,
+                        b:   &params.PageFaultsMaj,
+                },
+                C.VIR_PERF_PARAM_ALIGNMENT_FAULTS: typedParamsFieldInfo{
+                        set: &params.AlignmentFaultsSet,
+                        b:   &params.AlignmentFaults,
+                },
+                C.VIR_PERF_PARAM_REF_EMULATION_FAULTS: typedParamsFieldInfo{
+                        set: &params.EmulationFaultsSet,
+                        b:   &params.EmulationFaults,
+                },
 	}
 }
 
diff --git a/domain_compat.h b/domain_compat.h
index 9540435..a114173 100644
--- a/domain_compat.h
+++ b/domain_compat.h
@@ -45,6 +45,42 @@
 #define VIR_PERF_PARAM_REF_CPU_CYCLES "ref_cpu_cycles"
 #endif
 
+#ifndef VIR_PERF_PARAM_CPU_CLOCK
+#define VIR_PERF_PARAM_CPU_CLOCK "cpu_clock"
+#endif
+
+#ifndef VIR_PERF_PARAM_TASK_CLOCK
+#define VIR_PERF_PARAM_TASK_CLOCK "task_clock"
+#endif
+
+#ifndef VIR_PERF_PARAM_PAGE_FAULTS
+#define VIR_PERF_PARAM_PAGE_FAULTS "page_faults"
+#endif
+
+#ifndef VIR_PERF_PARAM_CONTEXT_SWITCHES
+#define VIR_PERF_PARAM_CONTEXT_SWITCHES "context_switches"
+#endif
+
+#ifndef VIR_PERF_PARAM_CPU_MIGRATIONS
+#define VIR_PERF_PARAM_CPU_MIGRATIONS "cpu_migrations"
+#endif
+
+#ifndef VIR_PERF_PARAM_PAGE_FAULTS_MIN
+#define VIR_PERF_PARAM_PAGE_FAULTS_MIN "page_faults_min"
+#endif
+
+#ifndef VIR_PERF_PARAM_PAGE_FAULTS_MAJ
+#define VIR_PERF_PARAM_PAGE_FAULTS_MAJ "page_faults_maj"
+#endif
+
+#ifndef VIR_PERF_PARAM_ALIGNMENT_FAULTS
+#define VIR_PERF_PARAM__ALIGNMENT_FAULTS "alignment_faults"
+#endif
+
+#ifndef VIR_PERF_PARAM_EMULATION_FAULTS
+#define VIR_PERF_PARAM_EMULATION_FAULTS "emulation_faults"
+#endif
+
 #ifndef VIR_DOMAIN_EVENT_ID_METADATA_CHANGE
 #define VIR_DOMAIN_EVENT_ID_METADATA_CHANGE 23
 #endif
-- 
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