[libvirt] [PATCH go v3] Add support for perf events
John Ferlan
jferlan at redhat.com
Mon Mar 6 20:08:07 UTC 2017
On 02/24/2017 07:12 AM, Nitesh Konkar wrote:
> Signed-off-by: Nitesh Konkar <nitkon12 at linux.vnet.ibm.com>
> ---
> connect.go | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> domain.go | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> domain_compat.h | 36 ++++++++++++++++++++++++++++++++++++
> 3 files changed, 144 insertions(+)
>
Well - I see it was sent... Helps when I sort by "From" to find things
like this that get buried in the libvir-list avalanche.
There is one adjustment that needs to be made - I can do that before
pushing, but I need to wait for the libvirt-perl 3.1 release to be created.
> diff --git a/connect.go b/connect.go
> index 3c53485..a4dd21b 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: ¶ms.RefCpuCyclesSet,
> ul: ¶ms.RefCpuCycles,
> },
> + "perf.cpu_clock": typedParamsFieldInfo{
> + set: ¶ms.CpuClockSet,
> + ul: ¶ms.CpuClock,
> + },
> + "perf.task_clock": typedParamsFieldInfo{
> + set: ¶ms.TaskClockSet,
> + ul: ¶ms.TaskClock,
> + },
> + "perf.page_faults": typedParamsFieldInfo{
> + set: ¶ms.PageFaultsSet,
> + ul: ¶ms.PageFaults,
> + },
> + "perf.context_switches": typedParamsFieldInfo{
> + set: ¶ms.ContextSwitchesSet,
> + ul: ¶ms.ContextSwitches,
> + },
> + "perf.cpu_migrations": typedParamsFieldInfo{
> + set: ¶ms.CpuMigrationsSet,
> + ul: ¶ms.CpuMigrations,
> + },
> + "perf.page_faults_min": typedParamsFieldInfo{
> + set: ¶ms.PageFaultsMinSet,
> + ul: ¶ms.PageFaultsMin,
> + },
> + "perf.page_faults_maj": typedParamsFieldInfo{
> + set: ¶ms.PageFaultsMajSet,
> + ul: ¶ms.PageFaultsMaj,
> + },
> + "perf.alignment_faults": typedParamsFieldInfo{
> + set: ¶ms.AlignmentFaultsSet,
> + ul: ¶ms.AlignmentFaults,
> + },
> + "perf.emulation_faults": typedParamsFieldInfo{
> + set: ¶ms.EmulationFaultsSet,
> + ul: ¶ms.EmulationFaults,
> + },
> }
> }
>
> diff --git a/domain.go b/domain.go
> index 2bd9852..9f3ecc3 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: ¶ms.RefCpuCyclesSet,
> b: ¶ms.RefCpuCycles,
> },
> + C.VIR_PERF_PARAM_CPU_CLOCK: typedParamsFieldInfo{
> + set: ¶ms.CpuClockSet,
> + b: ¶ms.CpuClock,
> + },
> + C.VIR_PERF_PARAM_TASK_CLOCK: typedParamsFieldInfo{
> + set: ¶ms.TaskClockSet,
> + b: ¶ms.TaskClock,
> + },
> + C.VIR_PERF_PARAM_PAGE_FAULTS: typedParamsFieldInfo{
> + set: ¶ms.PageFaultsSet,
> + b: ¶ms.PageFaults,
> + },
> + C.VIR_PERF_PARAM_CONTEXT_SWITCHES: typedParamsFieldInfo{
> + set: ¶ms.ContextSwitchesSet,
> + b: ¶ms.ContextSwitches,
> + },
> + C.VIR_PERF_PARAM_CPU_MIGRATIONS: typedParamsFieldInfo{
> + set: ¶ms.CpuMigrationsSet,
> + b: ¶ms.CpuMigrations,
> + },
> + C.VIR_PERF_PARAM_PAGE_FAULTS_MIN: typedParamsFieldInfo{
> + set: ¶ms.PageFaultsMinSet,
> + b: ¶ms.PageFaultsMin,
> + },
> + C.VIR_PERF_PARAM_PAGE_FAULTS_MAJ: typedParamsFieldInfo{
> + set: ¶ms.PageFaultsMajSet,
> + b: ¶ms.PageFaultsMaj,
> + },
> + C.VIR_PERF_PARAM_ALIGNMENT_FAULTS: typedParamsFieldInfo{
> + set: ¶ms.AlignmentFaultsSet,
> + b: ¶ms.AlignmentFaults,
> + },
> + C.VIR_PERF_PARAM_REF_EMULATION_FAULTS: typedParamsFieldInfo{
> + set: ¶ms.EmulationFaultsSet,
> + b: ¶ms.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
>
Based on the pattern I see from previous additions, these need to move
above the 3.0.0 comment... Add a /* 3.2.0 */ comment and then the
various defs.
Beyond this - it seems the previous pattern has been copied sufficiently.
John
> +#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
>
More information about the libvir-list
mailing list