summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bd95d13)
raw | patch | inline | side by side (parent: bd95d13)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Mon, 11 Jun 2007 13:36:40 +0000 (13:36 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Mon, 11 Jun 2007 13:36:40 +0000 (13:36 +0000) |
- NEWS mention the new file accessors
- rrd_update.c: remove unused some cruft
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1106 a5681a0c-68f1-0310-ab6d-d61299d08faa
- rrd_update.c: remove unused some cruft
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1106 a5681a0c-68f1-0310-ab6d-d61299d08faa
NEWS | patch | blob | history | |
src/rrd_update.c | patch | blob | history |
index e8ce64a5dead8af9390b97bd8e58d4e4ba391809..32ee7d42543c6a7d9608bc12bfe394152300030e 100644 (file)
--- a/NEWS
+++ b/NEWS
============
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
diff --git a/src/rrd_update.c b/src/rrd_update.c
index d8632a74057b6ae84956aa1e3506c9baa1402f1d..78f9a572e02e3bd70bedcdb6022899a61195fcc1 100644 (file)
--- a/src/rrd_update.c
+++ b/src/rrd_update.c
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);
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.
*/
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]);
break;
}
-
/* seek to the beginning of the rra's */
if (rra_current != rra_begin) {
#ifndef HAVE_MMAP
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
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,