+ ERROR("mic plugin: Problem getting Power Usage: %s",
+ MicGetErrorString(ret));
+ return (1);
+ }
+
+ /* power is in uWatts, current in mA, voltage in uVolts.. convert to
+ * base unit */
+ #define SUB_POWER(name) do { if (ignorelist_match(power_ignore,#name)==0) \
+ mic_submit_power(mic,"power",#name,(gauge_t)power_use.name.prr*0.000001); \
+ } while(0)
+ #define SUB_VOLTS(name) do { if (ignorelist_match(power_ignore,#name)==0) {\
+ mic_submit_power(mic,"power",#name,(gauge_t)(power_use.name.pwr*0.000001)); \
+ mic_submit_power(mic,"current",#name,(gauge_t)(power_use.name.cur*0.001)); \
+ mic_submit_power(mic,"voltage",#name,(gauge_t)(power_use.name.volt*0.000001)); \
+ }} while(0)
+
+ SUB_POWER(total0);
+ SUB_POWER(total1);
+ SUB_POWER(inst);
+ SUB_POWER(imax);
+ SUB_POWER(pcie);
+ SUB_POWER(c2x3);
+ SUB_POWER(c2x4);
+ SUB_VOLTS(vccp);
+ SUB_VOLTS(vddg);
+ SUB_VOLTS(vddq);
+
+ return (0);
+}
+
+static int mic_read (void)
+{
+ int i;
+ U32 ret;
+ int error;
+
+ error=0;
+ for (i=0;i<num_mics;i++) {
+ ret = MicInitAdapter(&mic_handle,&mics[i]);
+ if (ret != MIC_ACCESS_API_SUCCESS) {
+ ERROR("mic plugin: Problem initializing MicAdapter: %s",
+ MicGetErrorString(ret));
+ error=1;
+ }
+
+ if (error == 0 && show_memory)
+ error = mic_read_memory(i);
+
+ if (error == 0 && show_temps)
+ error = mic_read_temps(i);
+
+ if (error == 0 && (show_cpu || show_cpu_cores))
+ error = mic_read_cpu(i);
+
+ if (error == 0 && (show_power))
+ error = mic_read_power(i);
+
+ ret = MicCloseAdapter(mic_handle);
+ if (ret != MIC_ACCESS_API_SUCCESS) {
+ ERROR("mic plugin: Problem closing MicAdapter: %s",
+ MicGetErrorString(ret));
+ error=2;
+ break;
+ }