summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3c5f7f2)
raw | patch | inline | side by side (parent: 3c5f7f2)
author | Evan Felix <e@pnnl.gov> | |
Thu, 9 May 2013 23:24:33 +0000 (16:24 -0700) | ||
committer | Florian Forster <octo@collectd.org> | |
Sat, 11 May 2013 07:15:48 +0000 (09:15 +0200) |
src/mic.c | patch | blob | history |
diff --git a/src/mic.c b/src/mic.c
index 0f78f292518ec2a6794a96112e5750bc0618ac7b..fc4f0f6b3d8332afdf74f5542204057f4080aa8b 100644 (file)
--- a/src/mic.c
+++ b/src/mic.c
return (0);
}
-static void mic_submit_memory_use(int micnumber, const char *type_instance, gauge_t val)
+static void mic_submit_memory_use(int micnumber, const char *type_instance, U32 val)
{
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = val;
+ /* MicAccessAPI reports KB's of memory, adjust for this */
+ DEBUG("Memory Value Report; %u %lf",val,((gauge_t)val)*1024.0);
+ values[0].gauge = ((gauge_t)val)*1024.0;
vl.values=values;
vl.values_len=1;
@@ -141,18 +143,17 @@ static void mic_submit_memory_use(int micnumber, const char *type_instance, gaug
static int mic_read_memory(int mic)
{
U32 ret;
- U32 mem_total,mem_used,mem_bufs;
+ U32 mem_total,mem_free,mem_bufs;
- ret = MicGetMemoryUtilization(mic_handle,&mem_total,&mem_used,&mem_bufs);
+ ret = MicGetMemoryUtilization(mic_handle,&mem_total,&mem_free,&mem_bufs);
if (ret != MIC_ACCESS_API_SUCCESS) {
ERROR("Problem getting Memory Utilization: %s",MicGetErrorString(ret));
return (1);
}
- /* API reprots KB's of memory, adjust for this */
- mic_submit_memory_use(mic,"free",(mem_total-mem_used-mem_bufs)*1024);
- mic_submit_memory_use(mic,"used",mem_used*1024);
- mic_submit_memory_use(mic,"buffered",mem_bufs*1024);
- /*INFO("Memory Read: %u %u %u",mem_total,mem_used,mem_bufs);*/
+ mic_submit_memory_use(mic,"free",mem_free);
+ mic_submit_memory_use(mic,"used",mem_total-mem_free-mem_bufs);
+ mic_submit_memory_use(mic,"buffered",mem_bufs);
+ DEBUG("Memory Read: %u %u %u",mem_total,mem_free,mem_bufs);
return (0);
}