From 13b125913ae61a4e1de716b45b98b875a54bb5f8 Mon Sep 17 00:00:00 2001 From: oetiker Date: Wed, 17 Jan 2007 21:31:23 +0000 Subject: [PATCH] New functions lastupdate to efficiently get the last values fed into the rrd ... this also changes that the last values get stored even for ABSOLUTE and GAUGE data sources ... -- andy.riebs hp.com git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@951 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/acinclude.m4 | 39 +++++++++++++++++++++++ program/bindings/tcl/tclrrd.c | 58 ++++++++++++++++++++++++++++------- program/doc/Makefile.am | 2 +- program/src/Makefile.am | 1 + program/src/rrd_tool.c | 45 +++++++++++++++++++++++---- program/src/rrd_tool.h | 2 ++ program/src/rrd_update.c | 10 ++---- 7 files changed, 132 insertions(+), 25 deletions(-) diff --git a/program/acinclude.m4 b/program/acinclude.m4 index d0f8c0e8..b71fe8e8 100644 --- a/program/acinclude.m4 +++ b/program/acinclude.m4 @@ -507,3 +507,42 @@ esac ]) +dnl --------------------------------------------------------------------------- +dnl CF_DISABLE_ECHO version: 10 updated: 2003/04/17 22:27:11 +dnl --------------- +dnl stolen from xterm aclocal.m4 +dnl +dnl You can always use "make -n" to see the actual options, but it's hard to +dnl pick out/analyze warning messages when the compile-line is long. +dnl +dnl Sets: +dnl ECHO_LT - symbol to control if libtool is verbose +dnl ECHO_LD - symbol to prefix "cc -o" lines +dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) +dnl SHOW_CC - symbol to put before explicit "cc -c" lines +dnl ECHO_CC - symbol to put before any "cc" line +dnl +AC_DEFUN([CF_DISABLE_ECHO],[ +AC_MSG_CHECKING(if you want to see long compiling messages) +CF_ARG_DISABLE(echo, + [ --disable-echo display "compiling" commands], + [ + ECHO_LT='--silent' + ECHO_LD='@echo linking [$]@;' + RULE_CC=' @echo compiling [$]<' + SHOW_CC=' @echo compiling [$]@' + ECHO_CC='@' +],[ + ECHO_LT='' + ECHO_LD='' + RULE_CC='# compiling' + SHOW_CC='# compiling' + ECHO_CC='' +]) +AC_MSG_RESULT($enableval) +AC_SUBST(ECHO_LT) +AC_SUBST(ECHO_LD) +AC_SUBST(RULE_CC) +AC_SUBST(SHOW_CC) +AC_SUBST(ECHO_CC) +])dnl diff --git a/program/bindings/tcl/tclrrd.c b/program/bindings/tcl/tclrrd.c index e9cff801..33ceb15f 100644 --- a/program/bindings/tcl/tclrrd.c +++ b/program/bindings/tcl/tclrrd.c @@ -308,7 +308,42 @@ Rrd_Update(ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *ar return TCL_OK; } - +static int +Rrd_Lastupdate(ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *argv[]) + { + time_t last_update; + char **argv2; + char **ds_namv; + char **last_ds; + char s[30]; + Tcl_Obj *listPtr; + unsigned long ds_cnt, i; + + argv2 = getopt_init(argc, argv); + if (rrd_lastupdate(argc-1, argv2, &last_update, + &ds_cnt, &ds_namv, &last_ds) == 0) { + listPtr = Tcl_GetObjResult(interp); + for (i=0; i