meminfo-writer: ensure we always use the first parses memory info

It could plausibly be ignored for stupidly large thresholds
This commit is contained in:
Vincent Penquerc'h 2013-12-26 10:37:21 -05:00 committed by Marek Marczykowski-Górecki
parent 7e086970e9
commit 76afc2e72f

View File

@ -64,6 +64,7 @@ const char *parse(const char *buf)
if (used_mem_diff < 0) if (used_mem_diff < 0)
used_mem_diff = -used_mem_diff; used_mem_diff = -used_mem_diff;
if (used_mem_diff > used_mem_change_threshold if (used_mem_diff > used_mem_change_threshold
|| prev_used_mem == 0
|| (used_mem > prev_used_mem && used_mem * 13 / 10 > MemTotal || (used_mem > prev_used_mem && used_mem * 13 / 10 > MemTotal
&& used_mem_diff > used_mem_change_threshold/2)) { && used_mem_diff > used_mem_change_threshold/2)) {
prev_used_mem = used_mem; prev_used_mem = used_mem;