From: oetiker Date: Thu, 22 Sep 2005 20:18:12 +0000 (+0000) Subject: do not 'reload' data if you already have it! X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=68e35fd5715533c45f3cebd5f38f960a77f51206;p=rrdtool-all.git do not 'reload' data if you already have it! git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@689 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/program/src/rrd_graph.c b/program/src/rrd_graph.c index d80b74c4..97f6d68b 100644 --- a/program/src/rrd_graph.c +++ b/program/src/rrd_graph.c @@ -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; diff --git a/program/src/rrd_graph.h b/program/src/rrd_graph.h index 5a8af09a..b92ce9c9 100644 --- a/program/src/rrd_graph.h +++ b/program/src/rrd_graph.h @@ -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. */ diff --git a/program/src/rrd_graph_helper.c b/program/src/rrd_graph_helper.c index ec06d778..08f74d1f 100644 --- a/program/src/rrd_graph_helper.c +++ b/program/src/rrd_graph_helper.c @@ -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);