Skip to content

Commit

Permalink
fix layer of indirection in counters event
Browse files Browse the repository at this point in the history
  • Loading branch information
sflow committed Aug 28, 2020
1 parent c115b1d commit 174025b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/Linux/hsflowd.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ extern "C" {

// send the cs out to be annotated by other modules such as docker, xen, vrt and NVML
EVEvent *evt_host_cs = EVGetEvent(sp->pollBus, HSPEVENT_HOST_COUNTER_SAMPLE);
// TODO: use HSPPendingSample, and remove the extra later of & indirection here
// because it is not necessary.
EVEventTx(sp->rootModule, evt_host_cs, &cs, sizeof(cs));

SEMLOCK_DO(sp->sync_agent) {
Expand Down
2 changes: 1 addition & 1 deletion src/Linux/mod_docker.c
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ extern "C" {
char *str;
char buf[128];
while((str = parseNextTok(&gpu_uuids, ",", NO, 0, YES, buf, 128)) != NULL) {
myDebug(2, "parsing GPU uuidstr: %s", vvstr);
myDebug(2, "parsing GPU uuidstr: %s", str);
// expect GPU-<uuid>
if(my_strnequal(str, "GPU-", 4)) {
char *uuid = my_calloc(16);
Expand Down
8 changes: 6 additions & 2 deletions src/Linux/mod_nvml.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ extern "C" {
char uuidstr[128];
if(NVML_SUCCESS == nvmlDeviceGetUUID(gpu, uuidstr, 128)) {
myDebug(2, "nvml: deviceGetUUID(index=%u) returned %s", ii, uuidstr);
// uuuidstr may have "GPU-" prefix
char *uuidstr2 = uuidstr;
if(my_strnequal("GPU-", uuidstr2, 4))
uuidstr2 += 4;
HSPGpuID *id = my_calloc(sizeof(HSPGpuID));
if(parseUUID(uuidstr, id->uuid)) {
if(parseUUID(uuidstr2, id->uuid)) {
id->index = ii;
UTHashAdd(mdata->byUUID, id);
myDebug(1, "nvml: GPU uuid added to lookup table");
Expand Down Expand Up @@ -193,7 +197,7 @@ extern "C" {
}

static void evt_vm_cs(EVMod *mod, EVEvent *evt, void *data, size_t dataLen) {
HSPPendingCSample *ps = *(HSPPendingCSample **)data;
HSPPendingCSample *ps = (HSPPendingCSample *)data;
HSP_mod_NVML *mdata = (HSP_mod_NVML *)mod->data;
// For these events, poller->userData points to
// HSPVMState_DOCKER/SYSTEMD/KVM/XEN which
Expand Down

0 comments on commit 174025b

Please sign in to comment.