X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fintel_rdt.c;h=6beac7b42bc6fe02e375bd670103bd9c5e2e542e;hb=cb262c0e23692b6374d57ad3b3decb0d6c397949;hp=21f3a20635a7856ef44f38783f91fbf1d0e02efe;hpb=e1fda36ff7e4b5f508b630b614b182e298d91fb7;p=collectd.git diff --git a/src/intel_rdt.c b/src/intel_rdt.c index 21f3a206..6beac7b4 100644 --- a/src/intel_rdt.c +++ b/src/intel_rdt.c @@ -25,8 +25,8 @@ * Serhiy Pshyk **/ -#include "collectd.h" #include "common.h" +#include "collectd.h" #include @@ -460,6 +460,10 @@ static int rdt_config_cgroups(oconfig_item_t *item) { return (0); } +static void rdt_pqos_log(void *context, const size_t size, const char *msg) { + DEBUG(RDT_PLUGIN ": %s", msg); +} + static int rdt_preinit(void) { int ret; @@ -474,15 +478,12 @@ static int rdt_preinit(void) { return (-ENOMEM); } - /* In case previous instance of the application was not closed properly - * call fini and ignore return code. */ - pqos_fini(); + struct pqos_config pqos = {.fd_log = -1, + .callback_log = rdt_pqos_log, + .context_log = NULL, + .verbose = 0}; - /* TODO: - * stdout should not be used here. Will be reworked when support of log - * callback is added to PQoS library. - */ - ret = pqos_init(&(struct pqos_config){.fd_log = STDOUT_FILENO}); + ret = pqos_init(&pqos); if (ret != PQOS_RETVAL_OK) { ERROR(RDT_PLUGIN ": Error initializing PQoS library!"); goto rdt_preinit_error1; @@ -507,6 +508,9 @@ static int rdt_preinit(void) { goto rdt_preinit_error2; } + /* Reset pqos monitoring groups registers */ + pqos_mon_reset(); + return (0); rdt_preinit_error2: