Code

do not 'reload' data if you already have it!
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Thu, 22 Sep 2005 20:18:12 +0000 (20:18 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Thu, 22 Sep 2005 20:18:12 +0000 (20:18 +0000)
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@689 a5681a0c-68f1-0310-ab6d-d61299d08faa

src/rrd_graph.c
src/rrd_graph.h
src/rrd_graph_helper.c

index d80b74c49f379f19680cd5434b9b556632e5d3b2..97f6d68bb7241f6ae7c819e84447f3ffb8785fa8 100644 (file)
@@ -691,7 +691,7 @@ data_fetch(image_desc_t *im )
     int i,ii;
     int                skip;
 
-    /* pull the data from the log files ... */
+    /* pull the data from the rrd files ... */
     for (i=0;i< (int)im->gdes_c;i++){
        /* only GF_DEF elements fetch data */
        if (im->gdes[i].gf != GF_DEF) 
@@ -705,9 +705,9 @@ data_fetch(image_desc_t *im )
            if ((strcmp(im->gdes[i].rrd, im->gdes[ii].rrd) == 0)
                        && (im->gdes[i].cf    == im->gdes[ii].cf)
                        && (im->gdes[i].cf_reduce == im->gdes[ii].cf_reduce)
-                       && (im->gdes[i].start == im->gdes[ii].start)
-                       && (im->gdes[i].end   == im->gdes[ii].end)
-                       && (im->gdes[i].step  == im->gdes[ii].step)) {
+                       && (im->gdes[i].start_orig == im->gdes[ii].start_orig)
+                       && (im->gdes[i].end_orig   == im->gdes[ii].end_orig)
+                       && (im->gdes[i].step_orig  == im->gdes[ii].step_orig)) {
                /* OK, the data is already there.
                ** Just copy the header portion
                */
@@ -2881,6 +2881,7 @@ rrd_graph_init(image_desc_t *im)
     im->xsize = 400;
     im->ysize = 100;
     im->step = 0;
+    im->step_orig = 0;
     im->ylegend[0] = '\0';
     im->title[0] = '\0';
     im->minval = DNAN;
index 5a8af09aff5e4bc2e7be626abcf8249fa607b569..b92ce9c9ece0517da0b98a9e0e6117b1e0726842 100644 (file)
@@ -129,7 +129,9 @@ typedef  struct graph_desc_t {
 
     /* description of data fetched for the graph element */
     time_t         start,end; /* timestaps for first and last data element */
+    time_t         start_orig,end_orig; /* timestaps for first and last data element */
     unsigned long  step;      /* time between samples */
+    unsigned long  step_orig;      /* time between samples */
     unsigned long  ds_cnt; /* how many data sources are there in the fetch */
     long           data_first; /* first pointer to this data */
     char           **ds_namv; /* name of datasources  in the fetch. */
index ec06d7789fd8115215551c2eb42ee4ba3d092ae0..08f74d1ff5e84034516584543eafe76609b97f8e 100644 (file)
@@ -568,6 +568,7 @@ rrd_parse_def(char *line, unsigned int *eaten, graph_desc_t *gdp, image_desc_t *
        } else if (!strcmp("step",command)) {
            i=0;
            sscanf(&line[*eaten],"%lu%n",&gdp->step,&i);
+           gdp->step_orig = gdp->step;
            (*eaten)+=i;
            dprintf("- using step %lu\n",gdp->step);
        } else if (!strcmp("start",command)) {
@@ -617,6 +618,8 @@ rrd_parse_def(char *line, unsigned int *eaten, graph_desc_t *gdp, image_desc_t *
 
     gdp->start = start_tmp;
     gdp->end = end_tmp;
+    gdp->start_orig = start_tmp;
+    gdp->end_orig = end_tmp;
 
     dprintf("- start time %lu\n",gdp->start);
     dprintf("- end   time %lu\n",gdp->end);