#define KEY_INSTANCE_BY_GPUINDEX "InstanceByGPUIndex"
#define KEY_INSTANCE_BY_GPUNAME "InstanceByGPUName"
-static const char *config_keys[] = {
- KEY_GPUINDEX,
- KEY_IGNORESELECTED,
- KEY_INSTANCE_BY_GPUINDEX,
- KEY_INSTANCE_BY_GPUNAME
-};
+static const char *config_keys[] = {KEY_GPUINDEX, KEY_IGNORESELECTED,
+ KEY_INSTANCE_BY_GPUINDEX,
+ KEY_INSTANCE_BY_GPUNAME};
static const unsigned int n_config_keys = STATIC_ARRAY_SIZE(config_keys);
// This is a bitflag, necessitating the (extremely conservative) assumption
// use GPU index and device name by default
#define INSTANCE_BY_GPUINDEX (1 << 0)
#define INSTANCE_BY_GPUNAME (1 << 1)
-static uint8_t instance_by = INSTANCE_BY_GPUINDEX | INSTANCE_BY_GPUNAME;
+static uint8_t instance_by = INSTANCE_BY_GPUINDEX | INSTANCE_BY_GPUNAME;
static int nvml_config(const char *key, const char *value) {
if (strcasecmp(key, KEY_GPUINDEX) == 0) {
return -1;
}
-static void nvml_submit_gauge(int device_idx, const char *device_name,
- const char *type, const char *type_instance,
+static void nvml_submit_gauge(int device_idx, const char *device_name,
+ const char *type, const char *type_instance,
gauge_t nvml) {
value_list_t vl = VALUE_LIST_INIT;
// use gpu index and name or either of the two
if (instance_by == (INSTANCE_BY_GPUNAME | INSTANCE_BY_GPUINDEX)) {
- snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i-%s",
+ snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i-%s",
device_idx, device_name);
} else if (instance_by & INSTANCE_BY_GPUINDEX) {
snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", device_idx);
} else if (instance_by & INSTANCE_BY_GPUNAME) {
sstrncpy(vl.plugin_instance, device_name, sizeof(vl.plugin_instance));
- }
+ }
sstrncpy(vl.type, type, sizeof(vl.type));
TRY(nvmlDeviceGetHandleByIndex(ix, &dev));
char dev_name[NVML_DEVICE_NAME_BUFFER_SIZE] = {0};
- if( instance_by & INSTANCE_BY_GPUNAME ) {
+ if (instance_by & INSTANCE_BY_GPUNAME) {
TRY(nvmlDeviceGetName(dev, dev_name, NVML_DEVICE_NAME_BUFFER_SIZE));
}
-
+
// Try to be as lenient as possible with the variety of devices that are
// out there, ignoring any NOT_SUPPORTED errors gently.
nvmlMemory_t meminfo;