X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=src%2Frrd_info.c;h=f9c4604274ab80325c679512e30b04f7f619c2e1;hp=3a35d485728b380008e59e39e25a1d0d3692ff95;hb=ea8c705cc27ef33dee2cc6561ed51e16ddc5d0a9;hpb=7383625ce0413ce5dbcc0ced4ee4873c6df37735 diff --git a/src/rrd_info.c b/src/rrd_info.c index 3a35d48..f9c4604 100644 --- a/src/rrd_info.c +++ b/src/rrd_info.c @@ -71,6 +71,11 @@ info_t next->value.u_str = malloc(sizeof(char) * (strlen(value.u_str) + 1)); strcpy(next->value.u_str, value.u_str); break; + case RD_I_BLO: + next->value.u_blo.size = value.u_blo.size; + next->value.u_blo.ptr = malloc(sizeof(unsigned char)*value.u_blo.size); + memcpy(next->value.u_blo.ptr,value.u_blo.ptr,value.u_blo.size); + break; } return (next); } @@ -186,6 +191,10 @@ info_t *rrd_info_r( info.u_cnt = rrd.rra_def[i].row_cnt; cd = info_push(cd, sprintf_alloc("rra[%d].rows", i), RD_I_CNT, info); + info.u_cnt = rrd.rra_ptr[i].cur_row; + cd = info_push(cd, sprintf_alloc("rra[%d].cur_row", i), RD_I_CNT, + info); + info.u_cnt = rrd.rra_def[i].pdp_cnt; cd = info_push(cd, sprintf_alloc("rra[%d].pdp_per_row", i), RD_I_CNT, info); @@ -205,6 +214,13 @@ info_t *rrd_info_r( info.u_val = rrd.rra_def[i].par[RRA_seasonal_gamma].u_val; cd = info_push(cd, sprintf_alloc("rra[%d].gamma", i), RD_I_VAL, info); + if (atoi(rrd.stat_head->version) >= 4) { + info.u_val = + rrd.rra_def[i].par[RRA_seasonal_smoothing_window].u_val; + cd = info_push(cd, + sprintf_alloc("rra[%d].smoothing_window", i), + RD_I_VAL, info); + } break; case CF_FAILURES: info.u_val = rrd.rra_def[i].par[RRA_delta_pos].u_val; @@ -312,3 +328,58 @@ info_t *rrd_info_r( rrd_free(&rrd); return (data); } + + +void info_print( + info_t *data) +{ + long image_length = 0; + + while (data) { + printf("%s = ", data->key); + + switch (data->type) { + case RD_I_VAL: + if (isnan(data->value.u_val)) + printf("NaN\n"); + else + printf("%0.10e\n", data->value.u_val); + break; + case RD_I_CNT: + printf("%lu\n", data->value.u_cnt); + break; + case RD_I_INT: + printf("%d\n", data->value.u_int); + break; + case RD_I_STR: + printf("\"%s\"\n", data->value.u_str); + break; + case RD_I_BLO: + printf("BLOB_SIZE:%lu\n", data->value.u_blo.size); + fwrite(data->value.u_blo.ptr, data->value.u_blo.size, 1, stdout); + break; + } + data = data->next; + } +} + +void info_free( + info_t *data) +{ + info_t *save; + + while (data) { + save = data; + if (data->key) { + if (data->type == RD_I_STR) { + free(data->value.u_str); + } + if (data->type == RD_I_BLO) { + free(data->value.u_blo.ptr); + } + free(data->key); + } + data = data->next; + free(save); + } +}