On Mon, Jun 11, 2007 at 02:28:15AM +0200, Tobias Oetiker wrote:
>Folks,
>
>if you are following rrdtool development ... here is some news:
>
>* replaced libart with cairo/pango this makes for more
>  stable graphics output.
>
>* added grid snapping to all lines, the resulting graphs look much
>  crisper (see attached examples).
>
>* pango markup is available in all text
>  http://developer.gnome.org/doc/API/2.0/pango/PangoMarkupFormat.html
>
>* global tab stops. tabs on multiple lines are now aligned
>  everywhere.
>
>WARNING:
>
>Do not use this for production. it is still under heavy
>development.
>
>WARNING II:
>
>At least on AMD64 there seem to be some issues with the new mmaping
>code. So configure with --disable-mmap for now.

Note that this should be fixed in r1105
>
>  svn://svn.oetiker.ch/rrdtool/trunk/program

Tobi, please apply the following cosmetic hunks:

- NEWS mention the new file accessors
- rrd_update.c: remove unused some cruft

cheers,
Index: rrdtool-1.3/src/rrd_update.c
===================================================================
--- rrdtool-1.3/src/rrd_update.c	(revision 1105)
+++ rrdtool-1.3/src/rrd_update.c	(working copy)
@@ -325,6 +325,8 @@
     if (rrd_file == NULL) {
         goto err_free;
     }
+    /* We are now at the beginning of the rra's */
+    rra_current = rra_start = rra_begin = rrd_file->header_len;
 
     /* initialize time */
     version = atoi(rrd.stat_head->version);
@@ -337,26 +339,6 @@
         current_time_usec = 0;
     }
 
-    rra_current = rra_start = rra_begin = rrd_file->header_len;
-    /* This is defined in the ANSI C standard, section 7.9.5.3:
-
-       When a file is opened with udpate mode ('+' as the second
-       or third character in the ... list of mode argument
-       variables), both input and output may be performed on the
-       associated stream.  However, ...  input may not be directly
-       followed by output without an intervening call to a file
-       positioning function, unless the input operation encounters
-       end-of-file. */
-#if 0                   //def HAVE_MMAP
-    rrd_filesize = rrd_file->file_size;
-    fseek(rrd_file->fd, 0, SEEK_END);
-    rrd_filesize = ftell(rrd_file->fd);
-    fseek(rrd_file->fd, rra_current, SEEK_SET);
-#else
-//    fseek(rrd_file->fd, 0, SEEK_CUR);
-#endif
-
-
     /* get exclusive lock to whole file.
      * lock gets removed when we close the file.
      */
@@ -435,26 +417,6 @@
         rrd_set_error("allocating pdp_new ...");
         goto err_free_tmpl_idx;
     }
-#if 0                   //def HAVE_MMAP
-    rrd_mmaped_file = mmap(0,
-                           rrd_file->file_len,
-                           PROT_READ | PROT_WRITE,
-                           MAP_SHARED, fileno(in_file), 0);
-    if (rrd_mmaped_file == MAP_FAILED) {
-        rrd_set_error("error mmapping file %s", filename);
-        free(updvals);
-        free(pdp_temp);
-        free(tmpl_idx);
-        rrd_free(&rrd);
-        rrd_close(rrd_file);
-        return (-1);
-    }
-#ifdef USE_MADVISE
-    /* when we use mmaping we tell the kernel the mmap equivalent
-       of POSIX_FADV_RANDOM */
-    madvise(rrd_mmaped_file, rrd_filesize, POSIX_MADV_RANDOM);
-#endif
-#endif
     /* loop through the arguments. */
     for (arg_i = 0; arg_i < argc; arg_i++) {
         char     *stepper = strdup(argv[arg_i]);
@@ -558,7 +520,6 @@
             break;
         }
 
-
         /* seek to the beginning of the rra's */
         if (rra_current != rra_begin) {
 #ifndef HAVE_MMAP
@@ -1419,11 +1380,7 @@
         free(rra_step_cnt);
     rpnstack_free(&rpnstack);
 
-#if 0                   //def HAVE_MMAP
-    if (munmap(rrd_file->file_start, rrd_file->file_len) == -1) {
-        rrd_set_error("error writing(unmapping) file: %s", filename);
-    }
-#else
+#if 0
     //rrd_flush(rrd_file);    //XXX: really needed?
 #endif
     /* if we got here and if there is an error and if the file has not been
@@ -1442,6 +1399,8 @@
         rrd_set_error("seek rrd for live header writeback");
         goto err_free_pdp_new;
     }
+    /* for mmap, we did already write to the underlying mapping, so we do
+       not need to write again.  */
 #ifndef HAVE_MMAP
     if (version >= 3) {
         if (rrd_write(rrd_file, rrd.live_head,
Index: rrdtool-1.3/NEWS
===================================================================
--- rrdtool-1.3/NEWS	(revision 1105)
+++ rrdtool-1.3/NEWS	(working copy)
@@ -2,6 +2,14 @@
 ============
 Major Changes between 1.2.x and 1.3.x
 
+File access methods
+-------------------
+* introduced file-accessor functions rrd_read/rrd_seek/rrd_write
+* implemented full mmap-based file access with madvise hints for improved
+  scalability, much reduced memory-footprint and much less blocking on
+  disk
+* implemented optional full file-descriptor access instead of FILE* access
+
 Graphing
 --------
 * libart has been replaced by cairo/pango
_______________________________________________
rrd-developers mailing list
rrd-developers@lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Reply via email to