From d8890f9122d4d9db5abab6beacae8d4d779544b0 Mon Sep 17 00:00:00 2001 From: oetiker Date: Tue, 7 Apr 2009 06:37:17 +0000 Subject: [PATCH] fix for #213 restore old behaviour of --lazy. Even in lazy mode all the data calculation elements are run. The main time saving comes from the fact that the graph is not being drawn and the image does not have to be compressed. git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.3/program@1773 a5681a0c-68f1-0310-ab6d-d61299d08faa --- doc/rrdgraph.pod | 8 ++++++-- src/rrd_graph.c | 16 ++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/rrdgraph.pod b/doc/rrdgraph.pod index 5090fb9..06bf679 100644 --- a/doc/rrdgraph.pod +++ b/doc/rrdgraph.pod @@ -278,8 +278,12 @@ Note that for linear graphs, SI notation is used by default. [B<-z>|B<--lazy>] Only generate the graph if the current graph is out of date or not existent. -Note, that only the image size will be returned, if you run with lazy even -when using graphv and even when using PRINT. +Note, that all the calculations will happen regardless so that the output of +PRINT and graphv will be complete regardless. Note that the behaviour of +lazy in this regard has seen several changes over time. The only thing you +can realy rely on before rrdtool 1.3.7 is that lazy will not generate the +graph when it is already there and up to date, and also that it will output +the size of the graph. [B<-f>|B<--imginfo> I] diff --git a/src/rrd_graph.c b/src/rrd_graph.c index 3b352fd..2ad2cb1 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -3032,16 +3032,7 @@ int graph_paint( graph_desc_t *lastgdes = NULL; rrd_infoval_t info; -// PangoFontMap *font_map = pango_cairo_font_map_get_default(); - /* if we want and can be lazy ... quit now */ - if (lazy) { - info.u_cnt = im->ximg; - grinfo_push(im, sprintf_alloc("image_width"), RD_I_CNT, info); - info.u_cnt = im->yimg; - grinfo_push(im, sprintf_alloc("image_height"), RD_I_CNT, info); - return 0; - } /* pull the data from the rrd files ... */ if (data_fetch(im) == -1) return -1; @@ -3057,7 +3048,7 @@ int graph_paint( if (i < 0) return -1; - if ((i == 0) || lazy) + if ((i == 0)) return 0; /************************************************************** @@ -3084,6 +3075,11 @@ int graph_paint( info.u_cnt = im->end; grinfo_push(im, sprintf_alloc("graph_end"), RD_I_CNT, info); + /* if we want and can be lazy ... quit now */ + if (lazy){ + return 0 + }; + /* get actual drawing data and find min and max values */ if (data_proc(im) == -1) return -1; -- 2.30.2