/* * Read the cgroup memory statistics information of given group name. * * IN: * @group_name : The given group name. * @cg_stats: The memory statistics information. * * RETURN * 0 Success. * -1 Failed. */ int read_cg_mem_stats(const char* group_name, cg_mem_stats* cg_stats) { if (!group_name || !cg_stats) { fprintf(stderr, "rd_stats: the group name or memory stats is null.\n"); return -1; } read_mem_stats(group_name, cg_stats->stats); read_mem_usage(group_name, &(cg_stats->usage)); read_mem_swap_usage(group_name, &(cg_stats->mem_swap_usage)); read_mem_max_usage(group_name, &(cg_stats->max_usage)); read_mem_swap_max_usage(group_name, &(cg_stats->mem_swap_max_usage)); read_mem_limit(group_name, &(cg_stats->limit)); read_mem_swap_limit(group_name, &(cg_stats->mem_swap_limit)); return 0; }
static void statsAllocBlocks(double* val) { read_mem_stats(); *val=(double)meminfo.numBlocksAlloc; }
static void statsMaxFree(double* val) { read_mem_stats(); *val=(double)meminfo.maxBlockSizeFree; }
static void statsWSTotalBytes(double* val) { read_mem_stats(); *val=workspaceinfo.numBytesTotal; }
static void statsFreeBlocks(double* val) { read_mem_stats(); *val=(double)meminfo.numBlocksFree; }
static void statsWSFreeBytes(double* val) { read_mem_stats(); *val=workspaceinfo.numBytesFree; }
static void statsWSAllocBytes(double* val) { read_mem_stats(); *val=workspaceinfo.numBytesAlloc; }
static void statsTotalBytes(double* val) { read_mem_stats(); *val=meminfo.numBytesTotal; }
static void statsAllocBytes(double* val) { read_mem_stats(); *val=meminfo.numBytesAlloc; }
static void statsFreeBytes(double* val) { read_mem_stats(); *val=meminfo.numBytesFree; }