From 090e0fb8a96794b83d075a56ddf6b19fdb4e7c45 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/program@951 a5681a0c-68f1-0310-ab6d-d61299d08faa --- acinclude.m4 | 39 +++++++++++++++++++++++++++++ bindings/tcl/tclrrd.c | 58 +++++++++++++++++++++++++++++++++++-------- doc/Makefile.am | 2 +- src/Makefile.am | 1 + src/rrd_tool.c | 45 ++++++++++++++++++++++++++++----- src/rrd_tool.h | 2 ++ src/rrd_update.c | 10 +++----- 7 files changed, 132 insertions(+), 25 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index d0f8c0e..b71fe8e 100644 --- a/acinclude.m4 +++ b/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/bindings/tcl/tclrrd.c b/bindings/tcl/tclrrd.c index e9cff80..33ceb15 100644 --- a/bindings/tcl/tclrrd.c +++ b/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