From: oetiker Date: Fri, 18 May 2007 16:40:55 +0000 (+0000) Subject: added madvise MADV_RANDOM is rrd_update uses mmap X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a06692172dd04c95f264c7bff81d69ca02294d70;p=rrdtool.git added madvise MADV_RANDOM is rrd_update uses mmap git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@1066 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/configure.ac b/configure.ac index 202f370..df21955 100644 --- a/configure.ac +++ b/configure.ac @@ -248,7 +248,7 @@ AC_C_BIGENDIAN dnl for each function found we get a definition in config.h dnl of the form HAVE_FUNCTION -AC_CHECK_FUNCS(tzset mbstowcs opendir readdir chdir chroot getuid setlocale strerror strerror_r snprintf vsnprintf fpclass class fp_class isnan memmove strchr mktime getrusage gettimeofday posix_fadvise) +AC_CHECK_FUNCS(tzset mbstowcs opendir readdir chdir chroot getuid setlocale strerror strerror_r snprintf vsnprintf fpclass class fp_class isnan memmove strchr mktime getrusage gettimeofday posix_fadvise madvise) if test "x$enable_mmap" = xyes; then diff --git a/src/rrd_update.c b/src/rrd_update.c index 5f27c2f..608c314 100644 --- a/src/rrd_update.c +++ b/src/rrd_update.c @@ -427,7 +427,12 @@ _rrd_update(const char *filename, const char *tmplt, int argc, const char **argv fclose(rrd_file); return(-1); } +#ifdef HAVE_MADVISE + /* when we use mmaping we tell the kernel the mmap equivalent + of POSIX_FADV_RANDOM */ + madvise(rrd_mmaped_file,rrd_filesize,MADV_RANDOM); #endif +#endif /* loop through the arguments. */ for(arg_i=0; arg_i