From afdb6e580328bfea9570035f4d30e1c80ba6034a Mon Sep 17 00:00:00 2001 From: oetiker Date: Thu, 22 Sep 2005 20:18:12 +0000 Subject: [PATCH] do not 'reload' data if you already have it! git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@689 a5681a0c-68f1-0310-ab6d-d61299d08faa --- src/rrd_graph.c | 9 +++++---- src/rrd_graph.h | 2 ++ src/rrd_graph_helper.c | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/rrd_graph.c b/src/rrd_graph.c index d80b74c..97f6d68 100644 --- a/src/rrd_graph.c +++ b/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/src/rrd_graph.h b/src/rrd_graph.h index 5a8af09..b92ce9c 100644 --- a/src/rrd_graph.h +++ b/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/src/rrd_graph_helper.c b/src/rrd_graph_helper.c index ec06d77..08f74d1 100644 --- a/src/rrd_graph_helper.c +++ b/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); -- 2.11.0