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:
@@ -1,3 +1,12 @@
|
|||||||
|
2005-07-22 Benoît Dejean <TazForEver@dlfp.org>
|
||||||
|
|
||||||
|
* 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().
|
||||||
|
|
||||||
2005-07-09 Benoît Dejean <TazForEver@dlfp.org>
|
2005-07-09 Benoît Dejean <TazForEver@dlfp.org>
|
||||||
|
|
||||||
* netload.c: (read_value), (linux_2_6_stats), (linux_2_0_stats),
|
* netload.c: (read_value), (linux_2_6_stats), (linux_2_0_stats),
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
unsigned long long
|
unsigned long long
|
||||||
@@ -129,3 +130,16 @@ get_boot_time(glibtop *server)
|
|||||||
return boot_time;
|
return boot_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
size_t
|
||||||
|
get_page_size(void)
|
||||||
|
{
|
||||||
|
static size_t pagesize = 0;
|
||||||
|
|
||||||
|
if(G_UNLIKELY(!pagesize))
|
||||||
|
{
|
||||||
|
pagesize = getpagesize();
|
||||||
|
}
|
||||||
|
|
||||||
|
return pagesize;
|
||||||
|
}
|
||||||
|
@@ -117,6 +117,10 @@ unsigned long
|
|||||||
get_boot_time(glibtop *server) G_GNUC_INTERNAL;
|
get_boot_time(glibtop *server) G_GNUC_INTERNAL;
|
||||||
|
|
||||||
|
|
||||||
|
size_t
|
||||||
|
get_page_size(void) G_GNUC_INTERNAL;
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __LINUX__GLIBTOP_PRIVATE_H__ */
|
#endif /* __LINUX__GLIBTOP_PRIVATE_H__ */
|
||||||
|
@@ -51,7 +51,7 @@ void
|
|||||||
glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf, pid_t pid)
|
glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf, pid_t pid)
|
||||||
{
|
{
|
||||||
char buffer [BUFSIZ], *p;
|
char buffer [BUFSIZ], *p;
|
||||||
const size_t pagesize = getpagesize();
|
const size_t pagesize = get_page_size();
|
||||||
|
|
||||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_MEM, 0);
|
glibtop_init_s (&server, GLIBTOP_SYSDEPS_MEM, 0);
|
||||||
|
|
||||||
|
@@ -55,7 +55,7 @@ glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf,
|
|||||||
pid_t pid)
|
pid_t pid)
|
||||||
{
|
{
|
||||||
char buffer [BUFSIZ], *p;
|
char buffer [BUFSIZ], *p;
|
||||||
const size_t pagesize = getpagesize();
|
const size_t pagesize = get_page_size();
|
||||||
|
|
||||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_SEGMENT, 0);
|
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_SEGMENT, 0);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user