summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: be4bb5e)
raw | patch | inline | side by side (parent: be4bb5e)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sat, 27 Aug 2005 21:29:21 +0000 (21:29 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sat, 27 Aug 2005 21:29:21 +0000 (21:29 +0000) |
starting off with an unknown value when building a pdp instead of starting
out with 0 and then turning it into unknown later on if the number of uknown
seconds is equal or larger than the interval ...
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@678 a5681a0c-68f1-0310-ab6d-d61299d08faa
out with 0 and then turning it into unknown later on if the number of uknown
seconds is equal or larger than the interval ...
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@678 a5681a0c-68f1-0310-ab6d-d61299d08faa
program/src/rrd_update.c | patch | blob | history |
index e8d629ea22568b972f71cb858cb06838b8d5ea14..5c42f92784c4ea0e00efb6429f6b1135e6ab54d9 100644 (file)
--- a/program/src/rrd_update.c
+++ b/program/src/rrd_update.c
for(i=0;i<rrd.stat_head->ds_cnt;i++){
if(isnan(pdp_new[i]))
- rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt += floor(interval-0.5);
- else
- rrd.pdp_prep[i].scratch[PDP_val].u_val+= pdp_new[i];
+ rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt += floor(interval+0.5);
+ else {
+ if (isnan( rrd.pdp_prep[i].scratch[PDP_val].u_val )){
+ rrd.pdp_prep[i].scratch[PDP_val].u_val= pdp_new[i];
+ } else {
+ rrd.pdp_prep[i].scratch[PDP_val].u_val+= pdp_new[i];
+ }
+ }
#ifdef DEBUG
fprintf(stderr,
"NO PDP ds[%lu]\t"
pdp_temp[] will contain the rate for cdp */
for(i=0;i<rrd.stat_head->ds_cnt;i++){
- /* update pdp_prep to the current pdp_st */
+ /* update pdp_prep to the current pdp_st. */
+
if(isnan(pdp_new[i]))
rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt += floor(pre_int+0.5);
- else
- rrd.pdp_prep[i].scratch[PDP_val].u_val +=
- pdp_new[i]/interval*pre_int;
+ else {
+ if (isnan( rrd.pdp_prep[i].scratch[PDP_val].u_val )){
+ rrd.pdp_prep[i].scratch[PDP_val].u_val= pdp_new[i]/interval*pre_int;
+ } else {
+ rrd.pdp_prep[i].scratch[PDP_val].u_val+= pdp_new[i]/interval*pre_int;
+ }
+ }
+
/* if too much of the pdp_prep is unknown we dump it */
- if ((rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt
- > rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt) ||
+ if (
+ /* removed because this does not agree with the definition
+ a heart beat can be unknown */
+ /* (rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt
+ > rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt) || */
(occu_pdp_st-proc_pdp_st <=
rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt)) {
pdp_temp[i] = DNAN;
/* make pdp_prep ready for the next run */
if(isnan(pdp_new[i])){
rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt = floor(post_int + 0.5);
- rrd.pdp_prep[i].scratch[PDP_val].u_val = 0.0;
+ rrd.pdp_prep[i].scratch[PDP_val].u_val = DNAN;
} else {
rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt = 0;
rrd.pdp_prep[i].scratch[PDP_val].u_val =