Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> --- data/org.libvirt.Domain.xml | 6 ++++++ src/domain.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 19ec861..8d027dd 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -260,6 +260,12 @@ <arg name="flags" type="u" direction="in"/> <arg name="numaParameters" type="a{sv}" direction="out"/> </method> + <method name="GetPerfEvents"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetPerfEvents"/> + <arg name="flags" type="u" direction="in"/> + <arg name="perfEvents" type="a{sv}" direction="out"/> + </method> <method name="GetSchedulerParameters"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetSchedulerParametersFlags"/> diff --git a/src/domain.c b/src/domain.c index 0df2b23..608f1d1 100644 --- a/src/domain.c +++ b/src/domain.c @@ -1480,6 +1480,37 @@ virtDBusDomainGetNumaParameters(GVariant *inArgs, *outArgs = g_variant_new_tuple(&grecords, 1); } +static void +virtDBusDomainGetPerfEvents(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect = userData; + g_autoptr(virDomain) domain = NULL; + g_auto(virtDBusUtilTypedParams) params = { 0 }; + guint flags; + GVariant *grecords; + + g_variant_get(inArgs, "(u)", &flags); + + domain = virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (virDomainGetPerfEvents(domain, ¶ms.params, + ¶ms.nparams, flags) < 0) { + return virtDBusUtilSetLastVirtError(error); + } + + grecords = virtDBusUtilTypedParamsToGVariant(params.params, params.nparams); + + *outArgs = g_variant_new_tuple(&grecords, 1); +} + static void virtDBusDomainGetSchedulerParameters(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -2496,6 +2527,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = { { "GetMemoryParameters", virtDBusDomainGetMemoryParameters }, { "GetMetadata", virtDBusDomainGetMetadata }, { "GetNumaParameters", virtDBusDomainGetNumaParameters }, + { "GetPerfEvents", virtDBusDomainGetPerfEvents }, { "GetSchedulerParameters", virtDBusDomainGetSchedulerParameters }, { "GetStats", virtDBusDomainGetStats }, { "GetTime", virtDBusDomainGetTime }, -- 2.15.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list