#include "memUtil.h" void get_mem_usage(int mem_total, char buf[PANE_BUF], int *mem_usages, int i) { ///_|> descry: return total mem usage ///_|> mem_total: total memory for use in calculations ///_|> buf: buffer to write pane to ///_|> mem_usages: data array ///_|> i: current datapoint in data array ///_|> returning: void // Usage = total - unused int mem_usage = (int)min(mem_total, mem_total - get_file_line_value("/proc/meminfo", 2)); mem_usages[i] = (int)min((int)ceil(10.0 * mem_usage / mem_total), 10); draw_mem_title(buf, (float)mem_usage / 1e6, (float)mem_total / 1e6); draw_graph(buf, mem_usages, i); }