[rrd-developers] Re: Problems with MIN and graphing (Patch)

Chris Fedde chris at fedde.littleton.co.us
Tue Jan 25 00:11:29 MET 2000


Tobias Oetiker writes:
 +---------------
 | Hi Mary,
 | 
 | Here is the patch which fixes the MIN problem ...
 | 
 | ---------------
 | --- rrd_graph.c~        Fri Jan  7 09:43:39 2000
 | +++ rrd_graph.c Mon Jan 24 22:20:02 2000
 | @@ -559,12 +559,16 @@
 |          
 |      for (src_row = skiprows; src_row < row_cnt; src_row+=reduce_factor) {
 |         for (col=0;col<(*ds_cnt);col++){
 +---------------

Was this patch intended to work against the 1.0.9 at
        http://ee-staff.ethz.ch/~oetiker/webtools/rrdtool/pub/?

I applied the changes manually then re-diffed to make a new patch
file.  I also adjusted the indentation to be more conventional.  Hope
you don't mind :-)

BTW it works beautifully now. thanks!

chris

*** rrd_graph.c-	Sat Dec 25 13:10:02 1999
--- rrd_graph.c	Mon Jan 24 16:00:00 2000
***************
*** 559,583 ****
          
      for (src_row = skiprows; src_row < row_cnt; src_row+=reduce_factor) {
  	for (col=0;col<(*ds_cnt);col++){
! 	    double newval=0;
  	    unsigned long validval=0;
  	    for (i=0;i<reduce_factor && src_row+i<row_cnt;i++) {		
  		unsigned long ptr = (src_row+i)* (*ds_cnt)+col;
  		if (isnan((*data)[ptr])) continue; /* we can't help with NAN */
  		validval++;
! 		switch (cf) {
! 		case CF_AVERAGE:
! 		    newval += (*data)[ptr];
! 		    break;
! 		case CF_MINIMUM:
! 		    newval = min (newval,(*data)[ptr]);
! 		    break;
! 		case CF_MAXIMUM:
! 		    newval = max (newval,(*data)[ptr]);
! 		    break;
! 		case CF_LAST:
! 		    newval = (*data)[ptr];
! 		    break;
  		}
  	    }
  	    if (validval == 0){newval = DNAN;} else{
--- 559,587 ----
          
      for (src_row = skiprows; src_row < row_cnt; src_row+=reduce_factor) {
  	for (col=0;col<(*ds_cnt);col++){
! 	    double newval=DNAN;
  	    unsigned long validval=0;
  	    for (i=0;i<reduce_factor && src_row+i<row_cnt;i++) {		
  		unsigned long ptr = (src_row+i)* (*ds_cnt)+col;
  		if (isnan((*data)[ptr])) continue; /* we can't help with NAN */
  		validval++;
! 		if (isnan(newval)) {
! 		       newval = (*data)[ptr];
! 		} else {
! 		    switch (cf) {
! 		    case CF_AVERAGE:
! 		        newval += (*data)[ptr];
! 		        break;
! 		    case CF_MINIMUM:
! 			newval = min (newval,(*data)[ptr]);
! 			break;
! 		    case CF_MAXIMUM:
! 			newval = max (newval,(*data)[ptr]);
! 			break;
! 		    case CF_LAST:
! 			newval = (*data)[ptr];
! 			break;
! 		    }
  		}
  	    }
  	    if (validval == 0){newval = DNAN;} else{
__
Chris Fedde	  <chris at fedde.littleton.co.us>
303 773 9134

--
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-developers



More information about the rrd-developers mailing list