Reimplement frontend_linux_get_mem_used

This commit is contained in:
twinaphex 2016-06-19 00:15:04 +02:00
parent 0d9b345ae0
commit b82f4daae9

View File

@ -1917,11 +1917,18 @@ static uint64_t frontend_linux_get_mem_total(void)
return pageSize * totalNumPages;
}
static uint64_t frontend_linux_get_mem_used(void)
static uint64_t frontend_linux_get_mem_free(void)
{
uint64_t pageSize = sysconf(_SC_PAGESIZE);
uint64_t availNumPages = sysconf(_SC_AVPHYS_PAGES);
return pageSize * availNumPages;
return availNumPages * pageSize;
}
static uint64_t frontend_linux_get_mem_used(void)
{
uint64_t free_mem = frontend_linux_get_mem_free();
uint64_t total_mem = frontend_linux_get_mem_total();
return total_mem - free_mem;
}
frontend_ctx_driver_t frontend_ctx_linux = {