From: Tobias Oetiker Date: Sat, 21 Feb 2015 15:59:26 +0000 (+0100) Subject: reconfigure x-axis labels, so that they work form 1 second resolution up to 30 years X-Git-Tag: v1.5.0-rc2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bcba74283b8946b42bd18b912e8d4224be304437;p=thirdparty%2Frrdtool-1.x.git reconfigure x-axis labels, so that they work form 1 second resolution up to 30 years --- diff --git a/configure b/configure index 7e17e5f8..7f41d83b 100755 --- a/configure +++ b/configure @@ -709,6 +709,8 @@ BUILD_RRDGRAPH_FALSE BUILD_RRDGRAPH_TRUE BUILD_LIBWRAP_FALSE BUILD_LIBWRAP_TRUE +BUILD_LIBRADOS_FALSE +BUILD_LIBRADOS_TRUE BUILD_LIBDBI_FALSE BUILD_LIBDBI_TRUE BUILD_MULTITHREAD_FALSE @@ -900,6 +902,7 @@ enable_rpath with_libiconv_prefix with_libintl_prefix enable_libdbi +enable_librados enable_libwrap enable_perl enable_perl_site_install @@ -1582,6 +1585,7 @@ Optional Features: --disable-nls do not use Native Language Support --disable-rpath do not hardcode runtime library paths --disable-libdbi do not build in support for libdbi + --disable-librados do not build in support for librados --disable-libwrap do not build in support for libwrap (tcp wrapper) --disable-perl do not build the perl modules --enable-perl-site-install @@ -19186,6 +19190,38 @@ else fi +have_librados=no + +# Check whether --enable-librados was given. +if test "${enable_librados+set}" = set; then : + enableval=$enable_librados; +else + + ac_fn_c_check_header_mongrel "$LINENO" "rados/librados.h" "ac_cv_header_rados_librados_h" "$ac_includes_default" +if test "x$ac_cv_header_rados_librados_h" = xyes; then : + + +$as_echo "#define HAVE_LIBRADOS 1" >>confdefs.h + + LIBS="${LIBS} -lrados" + have_librados=yes + +fi + + + +fi + + + if test $have_librados != no; then + BUILD_LIBRADOS_TRUE= + BUILD_LIBRADOS_FALSE='#' +else + BUILD_LIBRADOS_TRUE='#' + BUILD_LIBRADOS_FALSE= +fi + + have_libwrap=no # Check whether --enable-libwrap was given. @@ -20036,6 +20072,17 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu +for ac_func in pango_font_map_create_context +do : + ac_fn_c_check_func "$LINENO" "pango_font_map_create_context" "ac_cv_func_pango_font_map_create_context" +if test "x$ac_cv_func_pango_font_map_create_context" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PANGO_FONT_MAP_CREATE_CONTEXT 1 +_ACEOF + +fi +done + fi if test $enable_rrd_restore != no; then @@ -21977,6 +22024,10 @@ if test -z "${BUILD_LIBDBI_TRUE}" && test -z "${BUILD_LIBDBI_FALSE}"; then as_fn_error $? "conditional \"BUILD_LIBDBI\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${BUILD_LIBRADOS_TRUE}" && test -z "${BUILD_LIBRADOS_FALSE}"; then + as_fn_error $? "conditional \"BUILD_LIBRADOS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${BUILD_LIBWRAP_TRUE}" && test -z "${BUILD_LIBWRAP_FALSE}"; then as_fn_error $? "conditional \"BUILD_LIBWRAP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -24613,6 +24664,10 @@ if test -z "${BUILD_LIBDBI_TRUE}" && test -z "${BUILD_LIBDBI_FALSE}"; then as_fn_error $? "conditional \"BUILD_LIBDBI\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${BUILD_LIBRADOS_TRUE}" && test -z "${BUILD_LIBRADOS_FALSE}"; then + as_fn_error $? "conditional \"BUILD_LIBRADOS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${BUILD_LIBWRAP_TRUE}" && test -z "${BUILD_LIBWRAP_FALSE}"; then as_fn_error $? "conditional \"BUILD_LIBWRAP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -27089,6 +27144,7 @@ echo " Build rrdcgi: $enable_rrdcgi" echo " Build librrd MT: $enable_pthread" echo " Use gettext: $USE_NLS" echo " With libDBI: $have_libdbi" +echo " With librados: $have_librados" echo " With libwrap: $have_libwrap" echo " With systemd dir: $with_systemdsystemunitdir" echo diff --git a/configure.ac b/configure.ac index f1dd366f..8a4f8320 100644 --- a/configure.ac +++ b/configure.ac @@ -609,6 +609,7 @@ dnl EX_CHECK_ALL(cairo, cairo_pdf_surface_create, cairo-pdf.h, dnl EX_CHECK_ALL(cairo, cairo_ps_surface_create, cairo-ps.h, cairo-ps, 1.10.2, http://cairographics.org/releases/, "") EX_CHECK_ALL(pangocairo-1.0, pango_cairo_context_set_font_options, pango/pango.h, pangocairo, 1.28.4, http://ftp.gnome.org/pub/GNOME/sources/pango/1.28, "") +AC_CHECK_FUNCS(pango_font_map_create_context) fi if test $enable_rrd_restore != no; then diff --git a/doc/Makefile.in b/doc/Makefile.in index 3c6acc6e..324edc4c 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -80,7 +80,8 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ @BUILD_LIBDBI_TRUE@am__append_1 = rrdgraph_libdbi.pod -@BUILD_LUA_TRUE@am__append_2 = rrdlua.pod +@BUILD_LIBRADOS_TRUE@am__append_2 = rrdrados.pod +@BUILD_LUA_TRUE@am__append_3 = rrdlua.pod subdir = doc DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -363,7 +364,7 @@ POD = bin_dec_hex.pod rrddump.pod rrdgraph_examples.pod rrdrestore.pod \ rrdinfo.pod rrdtune.pod rrdbuild.pod rrdflushcached.pod \ rrdcgi.pod rrdgraph.pod rrdlast.pod rrdlastupdate.pod \ rrdcreate.pod rrdgraph_data.pod rrdresize.pod rrdtutorial.pod \ - $(am__append_1) $(am__append_2) + $(am__append_1) $(am__append_2) $(am__append_3) POD3 = librrd.pod PMP = RRDs.pod RRDp.pod MAN = $(POD:.pod=.1) diff --git a/src/Makefile.in b/src/Makefile.in index 8195d600..f28c917d 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -95,13 +95,14 @@ target_triplet = @target@ @BUILD_RRDRESTORE_TRUE@am__append_2 = rrd_restore.c @BUILD_LIBDBI_TRUE@am__append_3 = rrd_fetch_libdbi.c -@BUILD_GETOPT_TRUE@am__append_4 = rrd_getopt.h -@BUILD_GETOPT_TRUE@am__append_5 = rrd_getopt.c rrd_getopt1.c -@BUILD_MULTITHREAD_TRUE@am__append_6 = librrd_th.la +@BUILD_LIBRADOS_TRUE@am__append_4 = rrd_rados.c +@BUILD_GETOPT_TRUE@am__append_5 = rrd_getopt.h +@BUILD_GETOPT_TRUE@am__append_6 = rrd_getopt.c rrd_getopt1.c +@BUILD_MULTITHREAD_TRUE@am__append_7 = librrd_th.la bin_PROGRAMS = rrdtool$(EXEEXT) rrdupdate$(EXEEXT) $(am__EXEEXT_1) \ $(am__EXEEXT_2) -@BUILD_RRDCGI_TRUE@am__append_7 = rrdcgi -@BUILD_RRDCACHED_TRUE@am__append_8 = rrdcached +@BUILD_RRDCGI_TRUE@am__append_8 = rrdcgi +@BUILD_RRDCACHED_TRUE@am__append_9 = rrdcached subdir = src DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(srcdir)/rrd_config.h.in $(srcdir)/librrd.sym.in.in \ @@ -182,15 +183,16 @@ am__librrd_th_la_SOURCES_DIST = mutex.c rrd_strtod.c rrd_create.c \ rrd_hw_update.c rrd_diff.c rrd_format.c rrd_info.c rrd_error.c \ rrd_open.c rrd_client.c rrd_nan_inf.c rrd_rpncalc.c \ rrd_utils.c rrd_snprintf.c rrd_update.c rrd_modify.c \ - quicksort.c rrd_getopt.c rrd_getopt1.c rrd_version.c \ - rrd_last.c rrd_lastupdate.c rrd_first.c rrd_dump.c \ - rrd_flushcached.c rrd_fetch.c rrd_fetch_cb.c rrd_resize.c \ - rrd_tune.c rrd_graph.c rrd_graph_helper.c rrd_xport.c \ - rrd_gfx.c pngsize.c rrd_restore.c rrd_fetch_libdbi.c \ - rrd_thread_safe.c -@BUILD_GETOPT_TRUE@am__objects_5 = librrd_th_la-rrd_getopt.lo \ + quicksort.c rrd_rados.c rrd_getopt.c rrd_getopt1.c \ + rrd_version.c rrd_last.c rrd_lastupdate.c rrd_first.c \ + rrd_dump.c rrd_flushcached.c rrd_fetch.c rrd_fetch_cb.c \ + rrd_resize.c rrd_tune.c rrd_graph.c rrd_graph_helper.c \ + rrd_xport.c rrd_gfx.c pngsize.c rrd_restore.c \ + rrd_fetch_libdbi.c rrd_thread_safe.c +@BUILD_LIBRADOS_TRUE@am__objects_5 = librrd_th_la-rrd_rados.lo +@BUILD_GETOPT_TRUE@am__objects_6 = librrd_th_la-rrd_getopt.lo \ @BUILD_GETOPT_TRUE@ librrd_th_la-rrd_getopt1.lo -am__objects_6 = librrd_th_la-mutex.lo librrd_th_la-rrd_strtod.lo \ +am__objects_7 = librrd_th_la-mutex.lo librrd_th_la-rrd_strtod.lo \ librrd_th_la-rrd_create.lo librrd_th_la-hash_32.lo \ librrd_th_la-rrd_parsetime.lo librrd_th_la-rrd_hw.lo \ librrd_th_la-rrd_hw_math.lo librrd_th_la-rrd_hw_update.lo \ @@ -200,21 +202,21 @@ am__objects_6 = librrd_th_la-mutex.lo librrd_th_la-rrd_strtod.lo \ librrd_th_la-rrd_nan_inf.lo librrd_th_la-rrd_rpncalc.lo \ librrd_th_la-rrd_utils.lo librrd_th_la-rrd_snprintf.lo \ librrd_th_la-rrd_update.lo librrd_th_la-rrd_modify.lo \ - librrd_th_la-quicksort.lo $(am__objects_5) -@BUILD_RRDGRAPH_TRUE@am__objects_7 = librrd_th_la-rrd_graph.lo \ + librrd_th_la-quicksort.lo $(am__objects_5) $(am__objects_6) +@BUILD_RRDGRAPH_TRUE@am__objects_8 = librrd_th_la-rrd_graph.lo \ @BUILD_RRDGRAPH_TRUE@ librrd_th_la-rrd_graph_helper.lo \ @BUILD_RRDGRAPH_TRUE@ librrd_th_la-rrd_xport.lo \ @BUILD_RRDGRAPH_TRUE@ librrd_th_la-rrd_gfx.lo \ @BUILD_RRDGRAPH_TRUE@ librrd_th_la-pngsize.lo -@BUILD_RRDRESTORE_TRUE@am__objects_8 = librrd_th_la-rrd_restore.lo -@BUILD_LIBDBI_TRUE@am__objects_9 = librrd_th_la-rrd_fetch_libdbi.lo -am__objects_10 = librrd_th_la-rrd_version.lo librrd_th_la-rrd_last.lo \ +@BUILD_RRDRESTORE_TRUE@am__objects_9 = librrd_th_la-rrd_restore.lo +@BUILD_LIBDBI_TRUE@am__objects_10 = librrd_th_la-rrd_fetch_libdbi.lo +am__objects_11 = librrd_th_la-rrd_version.lo librrd_th_la-rrd_last.lo \ librrd_th_la-rrd_lastupdate.lo librrd_th_la-rrd_first.lo \ librrd_th_la-rrd_dump.lo librrd_th_la-rrd_flushcached.lo \ librrd_th_la-rrd_fetch.lo librrd_th_la-rrd_fetch_cb.lo \ librrd_th_la-rrd_resize.lo librrd_th_la-rrd_tune.lo \ - $(am__objects_7) $(am__objects_8) $(am__objects_9) -am_librrd_th_la_OBJECTS = $(am__objects_6) $(am__objects_10) \ + $(am__objects_8) $(am__objects_9) $(am__objects_10) +am_librrd_th_la_OBJECTS = $(am__objects_7) $(am__objects_11) \ librrd_th_la-rrd_thread_safe.lo librrd_th_la_OBJECTS = $(am_librrd_th_la_OBJECTS) librrd_th_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ @@ -227,15 +229,17 @@ am__librrdupd_la_SOURCES_DIST = mutex.c rrd_strtod.c rrd_create.c \ rrd_hw_update.c rrd_diff.c rrd_format.c rrd_info.c rrd_error.c \ rrd_open.c rrd_client.c rrd_nan_inf.c rrd_rpncalc.c \ rrd_utils.c rrd_snprintf.c rrd_update.c rrd_modify.c \ - quicksort.c rrd_getopt.c rrd_getopt1.c rrd_not_thread_safe.c -@BUILD_GETOPT_TRUE@am__objects_11 = rrd_getopt.lo rrd_getopt1.lo -am__objects_12 = mutex.lo rrd_strtod.lo rrd_create.lo hash_32.lo \ + quicksort.c rrd_rados.c rrd_getopt.c rrd_getopt1.c \ + rrd_not_thread_safe.c +@BUILD_LIBRADOS_TRUE@am__objects_12 = rrd_rados.lo +@BUILD_GETOPT_TRUE@am__objects_13 = rrd_getopt.lo rrd_getopt1.lo +am__objects_14 = mutex.lo rrd_strtod.lo rrd_create.lo hash_32.lo \ rrd_parsetime.lo rrd_hw.lo rrd_hw_math.lo rrd_hw_update.lo \ rrd_diff.lo rrd_format.lo rrd_info.lo rrd_error.lo rrd_open.lo \ rrd_client.lo rrd_nan_inf.lo rrd_rpncalc.lo rrd_utils.lo \ rrd_snprintf.lo rrd_update.lo rrd_modify.lo quicksort.lo \ - $(am__objects_11) -am_librrdupd_la_OBJECTS = $(am__objects_12) rrd_not_thread_safe.lo + $(am__objects_12) $(am__objects_13) +am_librrdupd_la_OBJECTS = $(am__objects_14) rrd_not_thread_safe.lo librrdupd_la_OBJECTS = $(am_librrdupd_la_OBJECTS) @BUILD_RRDCGI_TRUE@am__EXEEXT_1 = rrdcgi$(EXEEXT) @BUILD_RRDCACHED_TRUE@am__EXEEXT_2 = rrdcached$(EXEEXT) @@ -538,7 +542,7 @@ UPD_C_FILES = mutex.c rrd_strtod.c rrd_create.c hash_32.c \ rrd_diff.c rrd_format.c rrd_info.c rrd_error.c rrd_open.c \ rrd_client.c rrd_nan_inf.c rrd_rpncalc.c rrd_utils.c \ rrd_snprintf.c rrd_update.c rrd_modify.c quicksort.c \ - $(am__append_5) + $(am__append_4) $(am__append_6) RRD_C_FILES = rrd_version.c rrd_last.c rrd_lastupdate.c rrd_first.c \ rrd_dump.c rrd_flushcached.c rrd_fetch.c rrd_fetch_cb.c \ rrd_resize.c rrd_tune.c $(am__append_1) $(am__append_2) \ @@ -549,9 +553,9 @@ noinst_HEADERS = unused.h gettext.h mutex.h rrd_strtod.h \ rrd_xport.h rrd.h rrd_rpncalc.h rrd_hw.h rrd_hw_math.h \ rrd_hw_update.h rrd_restore.h rrd_create.h fnv.h rrd_graph.h \ rrd_is_thread_safe.h rrd_modify.h rrd_update.h rrd_config.h \ - quicksort.h $(am__append_4) + quicksort.h $(am__append_5) noinst_LTLIBRARIES = librrdupd.la -lib_LTLIBRARIES = librrd.la $(am__append_6) +lib_LTLIBRARIES = librrd.la $(am__append_7) librrdupd_la_SOURCES = $(UPD_C_FILES) rrd_not_thread_safe.c librrdupd_la_LIBADD = $(CORE_LIBS) librrd_la_SOURCES = $(RRD_C_FILES) @@ -796,6 +800,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_nan_inf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_open.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_parsetime.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_rados.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_resize.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_restore.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_rpncalc.Plo@am__quote@ @@ -838,6 +843,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_not_thread_safe.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_open.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_parsetime.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_rados.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_resize.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_restore.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_rpncalc.Plo@am__quote@ @@ -1020,6 +1026,13 @@ librrd_th_la-quicksort.lo: quicksort.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-quicksort.lo `test -f 'quicksort.c' || echo '$(srcdir)/'`quicksort.c +librrd_th_la-rrd_rados.lo: rrd_rados.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_rados.lo -MD -MP -MF $(DEPDIR)/librrd_th_la-rrd_rados.Tpo -c -o librrd_th_la-rrd_rados.lo `test -f 'rrd_rados.c' || echo '$(srcdir)/'`rrd_rados.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/librrd_th_la-rrd_rados.Tpo $(DEPDIR)/librrd_th_la-rrd_rados.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rrd_rados.c' object='librrd_th_la-rrd_rados.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_rados.lo `test -f 'rrd_rados.c' || echo '$(srcdir)/'`rrd_rados.c + librrd_th_la-rrd_getopt.lo: rrd_getopt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_getopt.lo -MD -MP -MF $(DEPDIR)/librrd_th_la-rrd_getopt.Tpo -c -o librrd_th_la-rrd_getopt.lo `test -f 'rrd_getopt.c' || echo '$(srcdir)/'`rrd_getopt.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/librrd_th_la-rrd_getopt.Tpo $(DEPDIR)/librrd_th_la-rrd_getopt.Plo diff --git a/src/rrd_config.h.in b/src/rrd_config.h.in index a0dd1470..dbbb1a3e 100644 --- a/src/rrd_config.h.in +++ b/src/rrd_config.h.in @@ -189,6 +189,9 @@ /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM +/* have got librados installed */ +#undef HAVE_LIBRADOS + /* have got libwrap installed */ #undef HAVE_LIBWRAP @@ -246,6 +249,9 @@ /* Define to 1 if you have the `opendir' function. */ #undef HAVE_OPENDIR +/* Define to 1 if you have the `pango_font_map_create_context' function. */ +#undef HAVE_PANGO_FONT_MAP_CREATE_CONTEXT + /* we have pcre to replace missing regexp support form glib */ #undef HAVE_PCRE_COMPILE diff --git a/src/rrd_graph.c b/src/rrd_graph.c index fcf4c730..be363cb7 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -78,12 +78,30 @@ text_prop_t text_prop[] = { char week_fmt[128] = "Week %V"; +/* + 0 double minsec; -- minimum sec per pix + 1 long length; -- number of secs on the image + 2 enum tmt_en gridtm; -- grid interval in what ? + 3 long gridst; -- how many whats per grid + 4 enum tmt_en mgridtm; -- label interval in what ? + 5 long mgridst; -- how many whats per label + 6 enum tmt_en labtm; -- label interval in what ? + 7 long labst; -- how many whats per label + 8 long precis; -- label precision -> label placement + 9 char *stst; -- strftime string +*/ + xlab_t xlab[] = { - {0.0, 0, TMT_SECOND, 10, TMT_MINUTE, 1, TMT_MINUTE, 1, 0, "%H:%M"} + /* 0 1 2 3 4 5 6 7 8 9 */ + {0.0, 0, TMT_SECOND, 1, TMT_SECOND, 5, TMT_SECOND, 10, 0, "%H:%M:%S"} + , + {0.15, 0, TMT_SECOND, 5, TMT_SECOND, 15, TMT_SECOND, 30, 0, "%H:%M:%S"} + , + {0.4, 0, TMT_SECOND, 10, TMT_MINUTE, 1, TMT_MINUTE, 1, 0, "%H:%M"} , - {0.6, 0, TMT_SECOND, 20, TMT_MINUTE, 1, TMT_MINUTE, 1, 0, "%H:%M"} + {0.7, 0, TMT_SECOND, 20, TMT_MINUTE, 1, TMT_MINUTE, 1, 0, "%H:%M"} , - {1.0, 0, TMT_SECOND, 30, TMT_MINUTE, 2, TMT_MINUTE, 2, 0, "%H:%M"} + {1.0, 0, TMT_SECOND, 30, TMT_MINUTE, 1, TMT_MINUTE, 2, 0, "%H:%M"} , {2.0, 0, TMT_MINUTE, 1, TMT_MINUTE, 5, TMT_MINUTE, 5, 0, "%H:%M"} , @@ -91,39 +109,57 @@ xlab_t xlab[] = { , {10.0, 0, TMT_MINUTE, 5, TMT_MINUTE, 20, TMT_MINUTE, 20, 0, "%H:%M"} , - {30.0, 0, TMT_MINUTE, 10, TMT_HOUR, 1, TMT_HOUR, 1, 0, "%H:%M"} + {30.0, 0, TMT_MINUTE, 10, TMT_MINUTE, 30, TMT_HOUR, 1, 0, "%H:%M"} + , + {60.0, 0, TMT_MINUTE, 30, TMT_HOUR, 1, TMT_HOUR, 2, 0, "%H:%M"} + , + {60.0, 24 * 3600, TMT_MINUTE, 30, TMT_HOUR, 1, TMT_HOUR, 3, 0, "%a %H:%M"} + , + {140.0, 0, TMT_HOUR, 1, TMT_HOUR, 2, TMT_HOUR, 4, 0, "%a %H:%M"} + , + {180.0, 0, TMT_HOUR, 1, TMT_HOUR, 3, TMT_HOUR, 6, 0, "%a %H:%M"} + , + {300.0, 0, TMT_HOUR, 2, TMT_HOUR,6, TMT_HOUR,12, 0, "%a %H:%M"} + , + {600.0, 0, TMT_HOUR, 6, TMT_DAY, 1, TMT_DAY, 1, 24 * 3600, "%a %d %b"} + , + {1200.0, 0, TMT_HOUR, 6, TMT_DAY, 1, TMT_DAY, 1, 24 * 3600, "%d %b"} + , + {1800.0, 0, TMT_HOUR, 12, TMT_DAY, 1, TMT_DAY, 2, 24 * 3600, "%a %d %b"} + , + {2400.0, 0, TMT_HOUR, 12, TMT_DAY, 1, TMT_DAY, 2, 24 * 3600, "%d %b"} + , + {3600.0, 0, TMT_DAY, 1, TMT_WEEK, 1, TMT_WEEK, 1, 7 * 24 * 3600, week_fmt } , - {60.0, 0, TMT_MINUTE, 30, TMT_HOUR, 2, TMT_HOUR, 2, 0, "%H:%M"} + {12000.0 , 0, TMT_DAY, 1, TMT_MONTH, 1, TMT_MONTH, 1, 30 * 24 * 3600, "%B %Y"} , - {60.0, 24 * 3600, TMT_MINUTE, 30, TMT_HOUR, 2, TMT_HOUR, 6, 0, "%a %H:%M"} + {18000.0 , 0, TMT_DAY, 2, TMT_MONTH, 1, TMT_MONTH, 1, 30 * 24 * 3600, "%B %Y"} , - {180.0, 0, TMT_HOUR, 1, TMT_HOUR, 6, TMT_HOUR, 6, 0, "%H:%M"} + {23000.0 , 0, TMT_WEEK, 1, TMT_MONTH, 1, TMT_MONTH, 1, 30 * 24 * 3600, "%b %Y"} , - {180.0, 24 * 3600, TMT_HOUR, 1, TMT_HOUR, 6, TMT_HOUR, 12, 0, "%a %H:%M"} + {32000.0 , 0, TMT_WEEK, 1, TMT_MONTH, 1, TMT_MONTH, 1, 30 * 24 * 3600, "%b '%g"} , - /*{300, 0, TMT_HOUR,3, TMT_HOUR,12, TMT_HOUR,12, 12*3600,"%a %p"}, this looks silly */ - {600.0, 0, TMT_HOUR, 6, TMT_DAY, 1, TMT_DAY, 1, 24 * 3600, "%a"} + {42000.0 , 0, TMT_WEEK, 1, TMT_MONTH, 1, TMT_MONTH, 2, 30 * 24 * 3600, "%B %Y"} , - {1200.0, 0, TMT_HOUR, 6, TMT_DAY, 1, TMT_DAY, 1, 24 * 3600, "%d"} + {52000.0 , 0, TMT_WEEK, 1, TMT_MONTH, 1, TMT_MONTH, 2, 30 * 24 * 3600, "%b %Y"} , - {1800.0, 0, TMT_HOUR, 12, TMT_DAY, 1, TMT_DAY, 2, 24 * 3600, "%a %d"} + {78000.0 , 0, TMT_WEEK, 1, TMT_MONTH, 1, TMT_MONTH, 2, 30 * 24 * 3600, "%b '%g"} , - {2400.0, 0, TMT_HOUR, 12, TMT_DAY, 1, TMT_DAY, 2, 24 * 3600, "%a"} + {84000.0 , 0, TMT_WEEK, 2, TMT_MONTH, 1, TMT_MONTH, 3, 30 * 24 * 3600, "%B %Y"} , - {3600.0, 0, TMT_DAY, 1, TMT_WEEK, 1, TMT_WEEK, 1, 7 * 24 * 3600, week_fmt} + {94000.0 , 0, TMT_WEEK, 2, TMT_MONTH, 1, TMT_MONTH, 3, 30 * 24 * 3600, "%b %Y"} , - {3.0 * 3600.0, 0, TMT_WEEK, 1, TMT_MONTH, 1, TMT_WEEK, 2, 7 * 24 * 3600, week_fmt} + {120000.0 , 0, TMT_WEEK, 2, TMT_MONTH, 1, TMT_MONTH, 3, 30 * 24 * 3600, "%b '%g"} , - {6.0 * 3600.0, 0, TMT_MONTH, 1, TMT_MONTH, 1, TMT_MONTH, 1, 30 * 24 * 3600, - "%b"} + {130000.0 , 0, TMT_MONTH, 1, TMT_MONTH, 2, TMT_MONTH, 4, 0, "%Y-%m-%d"} , - {48.0 * 3600.0, 0, TMT_MONTH, 1, TMT_MONTH, 3, TMT_MONTH, 3, 30 * 24 * 3600, - "%b"} + {142000.0 , 0, TMT_MONTH, 1, TMT_MONTH, 3, TMT_MONTH, 6, 0, "%Y-%m-%d"} , - {315360.0, 0, TMT_MONTH, 3, TMT_YEAR, 1, TMT_YEAR, 1, 365 * 24 * 3600, "%Y"} + {220000.0 , 0, TMT_MONTH, 1, TMT_MONTH, 6, TMT_MONTH, 12, 0, "%Y-%m-%d"} , - {(double)(10 * 24 * 3600), 0, TMT_YEAR, 1, TMT_YEAR, 1, TMT_YEAR, 1, - 365 * 24 * 3600, "%y"} + {400000.0 , 0, TMT_MONTH, 2, TMT_MONTH, 12, TMT_MONTH, 12, 365*24*3600, "%Y"} + , + {800000.0 , 0, TMT_MONTH, 4, TMT_MONTH, 12, TMT_MONTH, 24, 365*24*3600, "%Y"} , {-1.0, 0, TMT_MONTH, 0, TMT_MONTH, 0, TMT_MONTH, 0, 0, ""} }; @@ -363,13 +399,13 @@ int im_free( free(im->daemon_addr); if (im->gdef_map){ - g_hash_table_destroy(im->gdef_map); + g_hash_table_destroy(im->gdef_map); } if (im->rrd_map){ g_hash_table_destroy(im->rrd_map); } - + for (i = 0; i < (unsigned) im->gdes_c; i++) { if (im->gdes[i].data_first) { @@ -980,11 +1016,11 @@ int data_fetch( im->gdes[i].data_first = 1; /* must reduce to at least im->step - otherwhise we end up with more data than we can handle in the - chart and visibility of data will be random */ + otherwhise we end up with more data than we can handle in the + chart and visibility of data will be random */ im->gdes[i].step = max(im->gdes[i].step,im->step); if (ft_step < im->gdes[i].step) { - + reduce_data(im->gdes[i].cf_reduce_set ? im->gdes[i].cf_reduce : im->gdes[i].cf, ft_step, &im->gdes[i].start, @@ -1233,7 +1269,7 @@ int data_calc( } } /* enumerate over time steps within a CDEF */ rpnp_freeextra(rpnp); - + break; default: continue; @@ -1296,7 +1332,7 @@ int data_proc( /* memory for the processed data */ for (i = 0; i < im->gdes_c; i++) { if ((im->gdes[i].gf == GF_LINE) - || (im->gdes[i].gf == GF_AREA) + || (im->gdes[i].gf == GF_AREA) || (im->gdes[i].gf == GF_TICK) || (im->gdes[i].gf == GF_GRAD) ) { @@ -2060,7 +2096,7 @@ int calc_horizontal_grid( if (im->unitslength < len + 2) im->unitslength = len + 2; - snprintf(im->ygrid_scale.labfmt, sizeof im->ygrid_scale.labfmt, + snprintf(im->ygrid_scale.labfmt, sizeof im->ygrid_scale.labfmt, "%%%d.%df%s", len, -fractionals, (im->symbol != ' ' ? " %c" : "")); } else { @@ -2150,7 +2186,7 @@ int draw_horizontal_grid( scaledstep * (double) i); } } else { - char sisym = (i == 0 ? ' ' : im->symbol); + char sisym = (i == 0 ? ' ' : im->symbol); if (im->primary_axis_format == NULL || im->primary_axis_format[0] == '\0') { if (im->extra_flags & ALTYGRID) { snprintf(graph_label,sizeof graph_label, @@ -2920,7 +2956,7 @@ void grid_paint( /* shift the box up a bit */ Y0 -= boxV * 0.4; - if (im->dynamic_labels && im->gdes[i].gf == GF_HRULE) { /* [-] */ + if (im->dynamic_labels && im->gdes[i].gf == GF_HRULE) { /* [-] */ cairo_save(im->cr); cairo_new_path(im->cr); cairo_set_line_width(im->cr, 1.0); @@ -3406,10 +3442,10 @@ int graph_paint( image_desc_t *im) { int lazy = lazy_check(im); - int cnt; + int cnt; - /* imgformat XML or higher dispatch to xport - * output format there is selected via graph_type + /* imgformat XML or higher dispatch to xport + * output format there is selected via graph_type */ if (im->imgformat >= IF_XML) { return rrd_graph_xport(im); @@ -3441,7 +3477,7 @@ int graph_paint( break; case GTYPE_XY: return graph_paint_xy(im,lazy,cnt); - break; + break; } /* final return with error*/ rrd_set_error("Graph type %i is not implemented",im->graph_type); @@ -3563,7 +3599,7 @@ int graph_paint_timestring( case GF_GRAD: { rrd_value_t diffval = im->maxval - im->minval; rrd_value_t maxlimit = im->maxval + 9 * diffval; - rrd_value_t minlimit = im->minval - 9 * diffval; + rrd_value_t minlimit = im->minval - 9 * diffval; for (ii = 0; ii < im->xsize; ii++) { /* fix data points at oo and -oo */ if (isinf(im->gdes[i].p_data[ii])) { @@ -3730,9 +3766,9 @@ int graph_paint_timestring( if (im->gdes[i].gf != GF_GRAD) { gfx_add_point(im, foreX[cntI], foreY[cntI]); } else { - gfx_add_rect_fadey(im, + gfx_add_rect_fadey(im, lastx, foreY[0], - foreX[cntI], foreY[cntI], lasty, + foreX[cntI], foreY[cntI], lasty, im->gdes[i].col, im->gdes[i].col2, im->gdes[i].gradheight @@ -3784,7 +3820,7 @@ int graph_paint_timestring( } idxI = -1; drawem = 0; - if (im->gdes[i].gf != GF_GRAD) + if (im->gdes[i].gf != GF_GRAD) gfx_close_path(im); } if (drawem != 0) { @@ -4034,7 +4070,7 @@ int graph_cairo_finish (image_desc_t *im) int graph_paint_xy( image_desc_t UNUSED(*im), int UNUSED(lazy), int UNUSED(cnt)) { - rrd_set_error("XY diagramm not implemented"); + rrd_set_error("XY diagramm not implemented"); return -1; } @@ -4093,7 +4129,7 @@ int gdes_alloc( im->gdes[im->gdes_c - 1].rrd[0] = '\0'; im->gdes[im->gdes_c - 1].ds = -1; im->gdes[im->gdes_c - 1].cf_reduce = CF_AVERAGE; - im->gdes[im->gdes_c - 1].cf_reduce_set = 0; + im->gdes[im->gdes_c - 1].cf_reduce_set = 0; im->gdes[im->gdes_c - 1].cf = CF_AVERAGE; im->gdes[im->gdes_c - 1].yrule = DNAN; im->gdes[im->gdes_c - 1].xrule = 0; @@ -4247,7 +4283,7 @@ rrd_info_t *rrd_graph_v( im_free(&im); return NULL; } - + /* Everything is now read and the actual work can start */ if (graph_paint(&im) == -1) { rrd_info_free(im.grinfo); @@ -4327,7 +4363,7 @@ void rrd_graph_init( #endif im->gdef_map = g_hash_table_new_full(g_str_hash, g_str_equal,g_free,NULL); //use of g_free() cause heap damage on windows. Key is allocated by malloc() in sprintf_alloc(), so free() must use - im->rrd_map = g_hash_table_new_full(g_str_hash, g_str_equal,free,NULL); + im->rrd_map = g_hash_table_new_full(g_str_hash, g_str_equal,free,NULL); im->graph_type = GTYPE_TIME; im->base = 1000; im->daemon_addr = NULL; @@ -4410,8 +4446,11 @@ void rrd_graph_init( fontmap = pango_cairo_font_map_get_default(); } +#ifdef HAVE_PANGO_FONT_MAP_CREATE_CONTEXT + context = pango_font_map_create_context((PangoFontMap*)fontmap); +#else context = pango_cairo_font_map_create_context((PangoCairoFontMap*)fontmap); - +#endif pango_cairo_context_set_resolution(context, 100); pango_cairo_update_context(im->cr,context); @@ -4702,16 +4741,16 @@ void rrd_graph_options( "%[0-9.e+-]:%[0-9.e+-]", double_str, double_str2 ) != 2) { - if ( rrd_strtodbl( double_str, 0, &(im->grid_dash_on),NULL) !=2 + if ( rrd_strtodbl( double_str, 0, &(im->grid_dash_on),NULL) !=2 || rrd_strtodbl( double_str2, 0, &(im->grid_dash_off), NULL) != 2 ){ rrd_set_error("expected grid-dash format float:float"); return; } } - break; + break; case 1009: /* enable dynamic labels */ im->dynamic_labels = 1; - break; + break; case 1010: strncpy(week_fmt,optarg,sizeof week_fmt); week_fmt[(sizeof week_fmt)-1]='\0'; @@ -5089,7 +5128,7 @@ int rrd_graph_color( #define OVECCOUNT 30 /* should be a multiple of 3 */ -static int bad_format_check(const char *pattern, char *fmt) { +static int bad_format_check(const char *pattern, char *fmt) { #ifdef HAVE_G_REGEX_NEW GError *gerr = NULL; GRegex *re = g_regex_new(pattern, G_REGEX_EXTENDED, 0, &gerr); @@ -5539,13 +5578,13 @@ void time_clean( char *format) { int j, jj; - + /* Handling based on - ANSI C99 Specifications http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf - - Single UNIX Specification version 2 http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html + - Single UNIX Specification version 2 http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html - POSIX:2001/Single UNIX Specification version 3 http://www.opengroup.org/onlinepubs/009695399/functions/strftime.html - POSIX:2008 Specifications http://www.opengroup.org/onlinepubs/9699919799/functions/strftime.html - Specifications tells + Specifications tells "If a conversion specifier is not one of the above, the behavior is undefined." C99 tells