summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1a717ae)
raw | patch | inline | side by side (parent: 1a717ae)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Mon, 20 Apr 2009 06:46:47 +0000 (06:46 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Mon, 20 Apr 2009 06:46:47 +0000 (06:46 +0000) |
doc/rrdinfo.pod | patch | blob | history | |
src/rrd_format.c | patch | blob | history | |
src/rrd_info.c | patch | blob | history | |
src/rrd_open.c | patch | blob | history | |
src/rrd_tool.h | patch | blob | history |
diff --git a/doc/rrdinfo.pod b/doc/rrdinfo.pod
index 00e5d165aaed969e21fd06740a19379d1798dd07..d147756c90be9e873c81983cd835b063f14dfa26 100644 (file)
--- a/doc/rrdinfo.pod
+++ b/doc/rrdinfo.pod
rrd_version = "0001"
step = 300
last_update = 955892996
+ header_size = 2872
ds[a].type = "GAUGE"
ds[a].minimal_heartbeat = 600
ds[a].min = NaN
diff --git a/src/rrd_format.c b/src/rrd_format.c
index 4e53e196481e9de2d0a9fcf50eadb4d5deed9d0d..b7e3eff8b339bb242b795a647595050abf18ec73 100644 (file)
--- a/src/rrd_format.c
+++ b/src/rrd_format.c
rrd_set_error("unknown data source name '%s'", ds_nam);
return -1;
}
+
+off_t rrd_get_header_size(
+ rrd_t *rrd)
+{
+ return sizeof(stat_head_t) + \
+ sizeof(ds_def_t) * rrd->stat_head->ds_cnt + \
+ sizeof(rra_def_t) * rrd->stat_head->rra_cnt + \
+ sizeof(time_t) + \
+ sizeof(live_head_t) + \
+ sizeof(pdp_prep_t) * rrd->stat_head->ds_cnt + \
+ sizeof(cdp_prep_t) * rrd->stat_head->ds_cnt * rrd->stat_head->rra_cnt + \
+ sizeof(rra_ptr_t) * rrd->stat_head->rra_cnt;
+}
diff --git a/src/rrd_info.c b/src/rrd_info.c
index 174bf1ab3cde821acfdc3e380ce320cb2188e91c..9b2363f850b3b143579789da7186435189494547 100644 (file)
--- a/src/rrd_info.c
+++ b/src/rrd_info.c
info.u_cnt = rrd.live_head->last_up;
cd = rrd_info_push(cd, sprintf_alloc("last_update"), RD_I_CNT, info);
+ info.u_cnt = rrd_get_header_size(&rrd);
+ cd = rrd_info_push(cd, sprintf_alloc("header_size"), RD_I_CNT, info);
+
for (i = 0; i < rrd.stat_head->ds_cnt; i++) {
info.u_str = rrd.ds_def[i].dst;
diff --git a/src/rrd_open.c b/src/rrd_open.c
index f74c6d8a677ea8c0e3068f271b8d970f61441f81..42426c6e092be4b3322274f5c72de7b15e3a7d9b 100644 (file)
--- a/src/rrd_open.c
+++ b/src/rrd_open.c
/* Are we creating a new file? */
if((rdwr & RRD_CREAT) && (rrd->stat_head != NULL))
{
- header_len = \
- sizeof(stat_head_t) + \
- sizeof(ds_def_t) * rrd->stat_head->ds_cnt + \
- sizeof(rra_def_t) * rrd->stat_head->rra_cnt + \
- sizeof(time_t) + \
- sizeof(live_head_t) + \
- sizeof(pdp_prep_t) * rrd->stat_head->ds_cnt + \
- sizeof(cdp_prep_t) * rrd->stat_head->ds_cnt * rrd->stat_head->rra_cnt + \
- sizeof(rra_ptr_t) * rrd->stat_head->rra_cnt;
+ header_len = rrd_get_header_size(rrd);
value_cnt = 0;
for (ui = 0; ui < rrd->stat_head->rra_cnt; ui++)
diff --git a/src/rrd_tool.h b/src/rrd_tool.h
index f58cd784264fecb93c391aa70a0667beefb9aa08..c1c9728436a327ea5f4d924eb207f4fbb9a7c359 100644 (file)
--- a/src/rrd_tool.h
+++ b/src/rrd_tool.h
long ds_match(
rrd_t *rrd,
char *ds_nam);
+ off_t rrd_get_header_size(
+ rrd_t *rrd);
double rrd_diff(
char *a,
char *b);