Source
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
static perfstat_memory_total_t m;
/* 4 KB */
static int vm_memory_total(AGENT_RESULT *result)
{
ZBX_PERFSTAT_MEMORY_TOTAL();
/* total real memory in pages */
SET_UI64_RESULT(result, m.real_total << ZBX_PERFSTAT_PAGE_SHIFT);
return SYSINFO_RET_OK;
}
static int vm_memory_pinned(AGENT_RESULT *result)
{
ZBX_PERFSTAT_MEMORY_TOTAL();
/* real memory which is pinned in pages */
SET_UI64_RESULT(result, m.real_pinned << ZBX_PERFSTAT_PAGE_SHIFT);
return SYSINFO_RET_OK;
}
static int vm_memory_free(AGENT_RESULT *result)
{
ZBX_PERFSTAT_MEMORY_TOTAL();
/* free real memory in pages */
SET_UI64_RESULT(result, m.real_free << ZBX_PERFSTAT_PAGE_SHIFT);
return SYSINFO_RET_OK;
}
static int vm_memory_used(AGENT_RESULT *result)