1 NEW RRD DATAFORMAT with Accessor Functions
2 ==========================================
4 Interested:
6 Tobias Oetiker <tobi@oetiker.ch>
7 Jake Brutlag <jakeb@microsoft.com>
8 - updating rrd_update to use accessor fks
10 Plan:
12 Encapsulating access to the RRD files through
13 special accessor functions which provide
14 access to the datastructures within the
15 RRDfiles.
17 pseudo code by Jake
19 For example, here is a current code block from rrd_update.c:
21 for (i=0;i<rrd.stat_head->ds_cnt;i++) {
22 if(isnan(pdp_new[i]))
23 rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt += interval;
24 else
25 rrd.pdp_prep[i].scratch[PDP_val].u_val+= pdp_new[i];
26 }
28 This could read:
30 for (i=0 ; i < getDSCount(&rrd) ;i++) {
31 if(isnan(pdp_new[i])) {
32 temp = getPDPParam(&rrd, i, PDP_unkn_sec_cnt);
33 temp.u_cnt += interval;
34 setPDPParam(&rrd, i, PDP_unkn_sec_cnt, temp);
35 } else {
36 temp = getPDPParam(&rrd, i, PDP_val);
37 temp.u_val += pdp_new[i];
38 setPDPParam(&rrd, i, PDP_val, temp);
39 }
40 }