Browse Source

Initialize rrd fields before writing to file.

tags/1.0.2
Vsevolod Stakhov 8 years ago
parent
commit
e1f1e0dfcb
1 changed files with 5 additions and 0 deletions
  1. 5
    0
      src/libutil/rrd.c

+ 5
- 0
src/libutil/rrd.c View File

} }


/* Fill DS section */ /* Fill DS section */
memset (&ds, 0, sizeof (ds));
memset (&ds.ds_nam, 0, sizeof (ds.ds_nam)); memset (&ds.ds_nam, 0, sizeof (ds.ds_nam));
memcpy (&ds.dst, "COUNTER", sizeof ("COUNTER")); memcpy (&ds.dst, "COUNTER", sizeof ("COUNTER"));
memset (&ds.par, 0, sizeof (ds.par)); memset (&ds.par, 0, sizeof (ds.par));
} }


/* Fill RRA section */ /* Fill RRA section */
memset (&rra, 0, sizeof (rra));
memcpy (&rra.cf_nam, "AVERAGE", sizeof ("AVERAGE")); memcpy (&rra.cf_nam, "AVERAGE", sizeof ("AVERAGE"));
rra.pdp_cnt = 1; rra.pdp_cnt = 1;
memset (&rra.par, 0, sizeof (rra.par)); memset (&rra.par, 0, sizeof (rra.par));
} }


/* Fill live header */ /* Fill live header */
memset (&lh, 0, sizeof (lh));
lh.last_up = (glong)initial_ticks; lh.last_up = (glong)initial_ticks;
lh.last_up_usec = (glong)((initial_ticks - lh.last_up) * 1e6f); lh.last_up_usec = (glong)((initial_ticks - lh.last_up) * 1e6f);


} }


/* Fill pdp prep */ /* Fill pdp prep */
memset (&pdp, 0, sizeof (pdp));
memcpy (&pdp.last_ds, "U", sizeof ("U")); memcpy (&pdp.last_ds, "U", sizeof ("U"));
memset (&pdp.scratch, 0, sizeof (pdp.scratch)); memset (&pdp.scratch, 0, sizeof (pdp.scratch));
pdp.scratch[PDP_val].dv = NAN; pdp.scratch[PDP_val].dv = NAN;
} }


/* Fill cdp prep */ /* Fill cdp prep */
memset (&cdp, 0, sizeof (cdp));
memset (&cdp.scratch, 0, sizeof (cdp.scratch)); memset (&cdp.scratch, 0, sizeof (cdp.scratch));
cdp.scratch[CDP_val].dv = NAN; cdp.scratch[CDP_val].dv = NAN;
cdp.scratch[CDP_unkn_pdp_cnt].lv = 0; cdp.scratch[CDP_unkn_pdp_cnt].lv = 0;

Loading…
Cancel
Save