From 3b98cbd3871a5f445c56c14f73805a14ea31dd7a Mon Sep 17 00:00:00 2001 From: oetiker Date: Fri, 25 May 2007 15:24:32 +0000 Subject: [PATCH] tobis old cruft removal program ... git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1086 a5681a0c-68f1-0310-ab6d-d61299d08faa --- src/rrd_stat.c | 151 ------------------------------------------------- 1 file changed, 151 deletions(-) delete mode 100644 src/rrd_stat.c diff --git a/src/rrd_stat.c b/src/rrd_stat.c deleted file mode 100644 index 4bd9e5b..0000000 --- a/src/rrd_stat.c +++ /dev/null @@ -1,151 +0,0 @@ -/***************************************************************************** - * RRDtool 1.2.23 Copyright by Tobi Oetiker, 1997-2007 - ***************************************************************************** - * rrd_stat Retreive the header part of an RRD - *****************************************************************************/ - -#include "rrd_tool.h" - -XXX:This file is not compiled.Is this on purpose ? extern char *tzname[2]; - -stat_node rrd_stat( - int argc, - char **argv) -{ - int i, ii, ix, iii = 0; - time_t now; - char somestring[255]; - rrd_value_t my_cdp; - long rra_base, rra_start, rra_next; - rrd_t rrd; - rrd_file_t *rrd_file; - - - rrd_file = rrd_open(argv[1], &rrd, RRD_READONLY); - if (rrd_file == NULL) { - return (-1); - } - puts(""); - puts(""); - printf("\t %s \n", rrd.stat_head->version); - printf("\t %lu \n", - rrd.stat_head->pdp_step); -#if HAVE_STRFTIME - strftime(somestring, 200, "%Y-%m-%d %H:%M:%S %Z", - localtime_r(&rrd.live_head->last_up, &tm)); -#else -# error "Need strftime" -#endif - printf("\t %ld \n\n", - rrd.live_head->last_up, somestring); - for (i = 0; i < rrd.stat_head->ds_cnt; i++) { - printf("\t\n"); - printf("\t\t %s \n", rrd.ds_def[i].ds_nam); - printf("\t\t %s \n", rrd.ds_def[i].dst); - printf("\t\t %lu \n", - rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt); - if (isnan(rrd.ds_def[i].par[DS_min_val].u_val)) { - printf("\t\t NaN \n"); - } else { - printf("\t\t %0.10e \n", - rrd.ds_def[i].par[DS_min_val].u_val); - } - if (isnan(rrd.ds_def[i].par[DS_max_val].u_val)) { - printf("\t\t NaN \n"); - } else { - printf("\t\t %0.10e \n", - rrd.ds_def[i].par[DS_max_val].u_val); - } - printf("\n\t\t\n"); - printf("\t\t %s \n", rrd.pdp_prep[i].last_ds); - if (isnan(rrd.pdp_prep[i].scratch[PDP_val].u_val)) { - printf("\t\t NaN \n"); - } else { - printf("\t\t %0.10e \n", - rrd.pdp_prep[i].scratch[PDP_val].u_val); - } - printf("\t\t %lu \n", - rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt); - - printf("\t\n\n"); - } - - puts(""); - - rra_base = rrd_file->header_len; - rra_next = rra_base; - - for (i = 0; i < rrd.stat_head->rra_cnt; i++) { - - long timer = 0; - - rra_start = rra_next; - rra_next += (rrd.stat_head->ds_cnt - * rrd.rra_def[i].row_cnt * sizeof(rrd_value_t)); - printf("\t\n"); - printf("\t\t %s \n", rrd.rra_def[i].cf_nam); - printf - ("\t\t %lu \n\n", - rrd.rra_def[i].pdp_cnt, - rrd.rra_def[i].pdp_cnt * rrd.stat_head->pdp_step); - printf("\t\t\n"); - for (ii = 0; ii < rrd.stat_head->ds_cnt; ii++) { - double value = - rrd.cdp_prep[i * rrd.stat_head->ds_cnt + - ii].scratch[CDP_val].u_val; - printf("\t\t\t"); - if (isnan(value)) { - printf(" NaN "); - } else { - printf(" %0.10e ", value); - } - printf(" %lu ", - rrd.cdp_prep[i * rrd.stat_head->ds_cnt + - ii].scratch[CDP_unkn_pdp_cnt].u_cnt); - printf("\n"); - } - printf("\t\t\n"); - - printf("\t\t\n"); - rrd_seek(rrd_file, (rra_start + (rrd.rra_ptr[i].cur_row + 1) - * rrd.stat_head->ds_cnt - * sizeof(rrd_value_t)), SEEK_SET); - timer = -(rrd.rra_def[i].row_cnt - 1); - ii = rrd.rra_ptr[i].cur_row; - for (ix = 0; ix < rrd.rra_def[i].row_cnt; ix++) { - ii++; - if (ii >= rrd.rra_def[i].row_cnt) { - rrd_seek(rrd_file, rra_start, SEEK_SET); - ii = 0; /* wrap if max row cnt is reached */ - } - now = (rrd.live_head->last_up - - rrd.live_head->last_up - % (rrd.rra_def[i].pdp_cnt * rrd.stat_head->pdp_step)) - + (timer * rrd.rra_def[i].pdp_cnt * rrd.stat_head->pdp_step); - - timer++; -#if HAVE_STRFTIME - strftime(somestring, 200, "%Y-%m-%d %H:%M:%S %Z", - localtime_r(&now, &tm)); -#else -# error "Need strftime" -#endif - printf("\t\t\t ", somestring); - for (iii = 0; iii < rrd.stat_head->ds_cnt; iii++) { - rrd_read(rrd_file, &my_cdp, sizeof(rrd_value_t) * 1); - if (isnan(my_cdp)) { - printf(" NaN "); - } else { - printf(" %0.10e ", my_cdp); - }; - } - printf("\n"); - } - printf("\t\t\n\t\n"); - - } - printf("\n"); - rrd_free(&rrd); - close(rrd_file->fd); - return (0); -} -- 2.30.2