]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
we do not actually have to write the cdp_prep area since it is memory mapped
authorTobias Oetiker <tobi@oetiker.ch>
Thu, 26 Feb 2015 07:09:42 +0000 (08:09 +0100)
committerTobias Oetiker <tobi@oetiker.ch>
Thu, 26 Feb 2015 07:09:42 +0000 (08:09 +0100)
src/rrd_hw.c

index d6a1505507f59e09b8a1a27f5d18f7968c435265..3e56c81bb845b42e609a9cf04406e565d0be4f0c 100644 (file)
@@ -212,11 +212,11 @@ int apply_smoother(
 
     /* as we are working through the value, we have to make sure to not double
        apply the smoothing after wrapping around. so best is to copy the rrd_values first */
-       
+
     rrd_values_cpy = (rrd_value_t *) calloc(row_length, sizeof(rrd_value_t));
     memcpy(rrd_values_cpy,rrd_values,sizeof(rrd_value_t)*row_length);
 
-    /* compute moving averages */    
+    /* compute moving averages */
     for (i = offset; i < row_count + offset; ++i) {
         for (j = 0; j < row_length; ++j) {
             k = MyMod(i, row_count);
@@ -277,6 +277,8 @@ int apply_smoother(
             (rrd->cdp_prep[offset]).scratch[CDP_hw_intercept].u_val +=
                 baseline[j];
         }
+/* if we are not running on mmap, lets write stuff to disk now */
+#ifndef MMAP
         /* flush cdp to disk */
         if (rrd_seek(rrd_file, sizeof(stat_head_t) +
                      rrd->stat_head->ds_cnt * sizeof(ds_def_t) +
@@ -296,9 +298,11 @@ int apply_smoother(
             free(rrd_values);
             return -1;
         }
+#endif
     }
 
     /* endif CF_SEASONAL */
+
     /* flush updated values to disk */
     if (rrd_seek(rrd_file, rra_start, SEEK_SET)) {
         rrd_set_error("apply_smoother: seek to pos %d failed", rra_start);
@@ -358,7 +362,7 @@ void reset_aberrant_coefficients(
             /* move to first entry of data source for this rra */
             rrd_seek(rrd_file, rra_start + ds_idx * sizeof(rrd_value_t),
                      SEEK_SET);
-            /* entries for the same data source are not contiguous, 
+            /* entries for the same data source are not contiguous,
              * temporal entries are contiguous */
             for (i = 0; i < rrd->rra_def[rra_idx].row_cnt; ++i) {
                 if (rrd_write(rrd_file, &nan_buffer, sizeof(rrd_value_t) * 1)