summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c265653)
raw | patch | inline | side by side (parent: c265653)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 21 Dec 2010 16:38:48 +0000 (16:38 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 21 Dec 2010 16:38:48 +0000 (16:38 +0000) |
2) "rrdfillmissing" was dummy. I have added code to do the work. The parameter has NOW to be in seconds. In doc it is
given in steps. The size of steps depends to much on size of graph so I think its easier to use seconds and internal
calculate the number of steps.
by Hans Jørgen Jakobsen
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@2155 a5681a0c-68f1-0310-ab6d-d61299d08faa
given in steps. The size of steps depends to much on size of graph so I think its easier to use seconds and internal
calculate the number of steps.
by Hans Jørgen Jakobsen
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@2155 a5681a0c-68f1-0310-ab6d-d61299d08faa
NEWS | patch | blob | history | |
doc/rrdgraph_libdbi.pod | patch | blob | history | |
src/rrd_fetch_libdbi.c | patch | blob | history |
index 0c593af414d457e89fbd4d5a0de3a6b48011a3a5..8a48192af00a43722022661f88ccfb70784bfac2 100644 (file)
--- a/NEWS
+++ b/NEWS
---
* exported rrd_update_v_r for theadsave rrd_update calls
+libDBI
+------
+* make rrdfillmissing actually work. The parameter is now in seconds and not
+ in steps for ease of use by Hans Jørgen Jakobsen
+
Bindings
--------
* dotnet by Chris Larsen of Euphoria Audio
index c84465d8f6ba736b1b65e2b275fc0f989255e19e..1e4aa4db1848bf58efe18abc2d73d443f803f318 100644 (file)
--- a/doc/rrdgraph_libdbi.pod
+++ b/doc/rrdgraph_libdbi.pod
=head1 SYNOPSIS
-E<lt>rrdfileE<gt> = B<sql//E<lt>libdbi driverE<gt>/E<lt>driver-option-nameE<gt>=E<lt>driver-option-valueE<gt>/...[/rrdminstepsize=E<lt>stepsizeE<gt>][/rrdfillmissing=E<lt>fill missing n samplesE<gt>]//E<lt>tableE<gt>/E<lt>unixtimestamp columnE<gt>/E<lt>data value columnE<gt>[/derive]/E<lt>where clause 1E<gt>/.../E<lt>where clause nE<gt>>
+E<lt>rrdfileE<gt> = B<sql//E<lt>libdbi driverE<gt>/E<lt>driver-option-nameE<gt>=E<lt>driver-option-valueE<gt>/...[/rrdminstepsize=E<lt>stepsizeE<gt>][/rrdfillmissing=E<lt>fill missing n secondsE<gt>]//E<lt>tableE<gt>/E<lt>unixtimestamp columnE<gt>/E<lt>data value columnE<gt>[/derive]/E<lt>where clause 1E<gt>/.../E<lt>where clause nE<gt>>
=head1 DESCRIPTION
defines the minimum number of the step-length used for graphing (default: 300 seconds)
-=item B</rrdfillmissing>=B<E<lt>fill missing stepsE<gt>>
+=item B</rrdfillmissing>=B<E<lt>fill missing secondsE<gt>>
- defines the number of steps to fill with the last value to avoid NaN boxes due to data-insertation jitter (default: 0 steps)
+ defines the number of seconds to fill with the last value to avoid NaN boxes due to data-insertation jitter (default: 0 seconds)
=item B<E<lt>tableE<gt>>
diff --git a/src/rrd_fetch_libdbi.c b/src/rrd_fetch_libdbi.c
index 2c4c722ee46ecbbbd8d95ece84c8deb8c4899d5a..b4f0fc7912f012e469423131cffcdb7340e180e9 100644 (file)
--- a/src/rrd_fetch_libdbi.c
+++ b/src/rrd_fetch_libdbi.c
(*data)[idx*(*ds_cnt)+1]=r_value; /* AVG */
(*data)[idx*(*ds_cnt)+2]=r_value; /* MAX */
(*data)[idx*(*ds_cnt)+3]=1; /* COUNT */
- (*data)[idx*(*ds_cnt)+4]=r_value; /* SIGMA */
+ (*data)[idx*(*ds_cnt)+4]=r_value*r_value; /* SIGMA */
} else {
/* MIN */
if ((*data)[idx*(*ds_cnt)+0]>r_value) { (*data)[idx*(*ds_cnt)+0]=r_value; }
}
}
+ /* Fill in missing values */
+ fillmissing/=(*step);/* Convert from seconds to steps */
+ if (fillmissing>0) {
+ int copy_left=fillmissing;
+ for(idx=1;idx<rows;idx++) {
+ long count=(*data)[idx*(*ds_cnt)+3];
+ if (count==0) {
+ /* No data this bin */
+ if (copy_left>0) {
+ /* But we can copy from previous */
+ int idx_p=idx-1;
+ (*data)[idx*(*ds_cnt)+0]=(*data)[idx_p*(*ds_cnt)+0];
+ (*data)[idx*(*ds_cnt)+1]=(*data)[idx_p*(*ds_cnt)+1];
+ (*data)[idx*(*ds_cnt)+2]=(*data)[idx_p*(*ds_cnt)+2];
+ (*data)[idx*(*ds_cnt)+3]=(*data)[idx_p*(*ds_cnt)+3];
+ (*data)[idx*(*ds_cnt)+4]=(*data)[idx_p*(*ds_cnt)+4];
+ copy_left--;
+ }
+ }else{
+ copy_left=fillmissing;
+ }
+ }
+ }
+
/* and return OK */
return 0;
}