Cached getpagesize().
* glibtop_private.c: (get_page_size): * glibtop_private.h: * procmem.c: (glibtop_get_proc_mem_s): * procsegment.c: (glibtop_get_proc_segment_s): Cached getpagesize().
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
unsigned long long
|
||||
@@ -129,3 +130,16 @@ get_boot_time(glibtop *server)
|
||||
return boot_time;
|
||||
}
|
||||
|
||||
|
||||
size_t
|
||||
get_page_size(void)
|
||||
{
|
||||
static size_t pagesize = 0;
|
||||
|
||||
if(G_UNLIKELY(!pagesize))
|
||||
{
|
||||
pagesize = getpagesize();
|
||||
}
|
||||
|
||||
return pagesize;
|
||||
}
|
||||
|
Reference in New Issue
Block a user