X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fmic.c;h=d9eb8254fa776de1c6b3316c24a289817291f9af;hb=82ca30f400df01dac6057d4d974d088347d433cc;hp=efd7c1da559091b9a18872577d8980d741f05fcd;hpb=56f8c6aabc44dc49eab9410ba0f98a7ba2362c5b;p=collectd.git diff --git a/src/mic.c b/src/mic.c index efd7c1da..d9eb8254 100644 --- a/src/mic.c +++ b/src/mic.c @@ -26,12 +26,18 @@ #include #include #include +#include #define MAX_MICS 32 +#define MAX_CORES 256 static MicDeviceOnSystem mics[MAX_MICS]; static U32 numMics = MAX_MICS; static HANDLE micHandle=NULL; +#define NUM_THERMS 7 +static const int therms[NUM_THERMS] = {eMicThermalDie,eMicThermalDevMem,eMicThermalFin,eMicThermalFout,eMicThermalVccp,eMicThermalVddg,eMicThermalVddq}; +static const char *thermNames[NUM_THERMS] = {"die","devmem","fin","fout","vccp","vddg","vddq"}; + static int mic_init (void) { @@ -48,7 +54,7 @@ static int mic_init (void) return (0); } -static void mic_submit_memory_use(int micnumber, char *type, gauge_t val) +static void mic_submit_memory_use(int micnumber, const char *type, gauge_t val) { value_t values[1]; value_list_t vl = VALUE_LIST_INIT; @@ -67,12 +73,58 @@ static void mic_submit_memory_use(int micnumber, char *type, gauge_t val) plugin_dispatch_values (&vl); } +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); +} + +static void mic_submit_cpu(int micnumber, const char *type, 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)); + ssnprintf (vl.plugin_instance, sizeof (vl.plugin_instance), "%i", micnumber); + strncpy (vl.type, "cpu", sizeof (vl.type)); + if (core < 0) + strncpy (vl.type_instance, type, sizeof (vl.type_instance)); + else + ssnprintf (vl.type_instance, sizeof (vl.type_instance), "%i-%s", core, type); + + plugin_dispatch_values (&vl); +} + + + static int mic_read (void) { - int i; - U32 ret; + int i,j; + U32 ret,bufferSize; + U32 *tempBuffer; int error; U32 mem_total,mem_used,mem_bufs; + MicCoreUtil coreUtil; + MicCoreJiff coreJiffs[MAX_CORES]; error=0; for (i=0;i