+static void mic_submit_temp(int micnumber, const char *type, gauge_t val)
+{
+ value_t values[1];
+ value_list_t vl = VALUE_LIST_INIT;
+
+ values[0].gauge = val;
+
+ vl.values=values;
+ vl.values_len=1;
+
+ strncpy (vl.host, hostname_g, sizeof (vl.host));
+ strncpy (vl.plugin, "mic", sizeof (vl.plugin));
+ ssnprintf (vl.plugin_instance, sizeof (vl.plugin_instance),
+ "%i", micnumber);
+ strncpy (vl.type, "temperature", sizeof (vl.type));
+ strncpy (vl.type_instance, type, sizeof (vl.type_instance));
+
+ plugin_dispatch_values (&vl);
+}
+
+/* Gather Temperature Information */
+static int mic_read_temps(int mic)
+{
+ size_t num_therms = STATIC_ARRAY_SIZE(therm_ids);
+ size_t j;
+
+ for (j = 0; j < num_therms; j++) {
+ U32 status;
+ U32 temp_buffer;
+ U32 buffer_size = (U32)sizeof(temp_buffer);
+ char const *name = therm_names[j];
+
+ if (ignorelist_match(temp_ignore, name) != 0)
+ continue;
+
+ status = MicGetTemperature(mic_handle, therm_ids[j],
+ &temp_buffer, &buffer_size);
+ if (status != MIC_ACCESS_API_SUCCESS) {
+ ERROR("mic plugin: Error reading temperature \"%s\": "
+ "%s", name, MicGetErrorString(status));
+ return (1);
+ }
+ mic_submit_temp(mic, name, temp_buffer);
+ }
+ return (0);
+}
+
+static void mic_submit_cpu(int micnumber, const char *type_instance,
+ int core, derive_t val)
+{
+ value_t values[1];
+ value_list_t vl = VALUE_LIST_INIT;
+
+ values[0].derive = val;
+
+ vl.values=values;
+ vl.values_len=1;
+
+ strncpy (vl.host, hostname_g, sizeof (vl.host));
+ strncpy (vl.plugin, "mic", sizeof (vl.plugin));
+ if (core < 0) /* global aggregation */
+ ssnprintf (vl.plugin_instance, sizeof (vl.plugin_instance),
+ "%i", micnumber);
+ else /* per-core statistics */
+ ssnprintf (vl.plugin_instance, sizeof (vl.plugin_instance),
+ "%i-cpu-%i", micnumber, core);
+ strncpy (vl.type, "cpu", sizeof (vl.type));
+ strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
+
+ plugin_dispatch_values (&vl);
+}
+
+/*Gather CPU Utilization Information */
+static int mic_read_cpu(int mic)
+{
+ MicCoreUtil core_util;
+ MicCoreJiff core_jiffs[MAX_CORES];
+ U32 core_jiffs_size;
+ U32 status;
+
+ core_jiffs_size = MAX_CORES * sizeof(MicCoreJiff);
+ status = MicGetCoreUtilization(mic_handle, &core_util,
+ core_jiffs, &core_jiffs_size);
+ if (status != MIC_ACCESS_API_SUCCESS) {
+ ERROR("mic plugin: Problem getting CPU utilization: %s",
+ MicGetErrorString(status));
+ return(-1);