However, then compilation fails with ======== gcc -DHAVE_CONFIG_H -I. -I/ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient -I../.. -I/ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient -I../mapilib -I/ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../mapilib -I../../common/options -I/ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../../common/options -I../../common/stream -I/ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../../common/stream -I/ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/ -g -Werror -Wall -Wextra -W -Werror-implicit-function-declaration -Wpointer-arith -Wdeclaration-after-statement -Wundef -Wformat=2 -Wno-format-nonliteral -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-format-attribute -Wmissing-prototypes -Wold-style-definition -Wpacked -Wunknown-pragmas -Wvariadic-macros -fstack-protector-all -Wstack-protector -Wpacked-bitfield-compat -Wsync-nand -Wjump-misses-init -Wmissing-include-dirs -Wlogical-op -Wunreachable-code -D_REENTRANT -c /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/profiler-dummy.c In file included from /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/profiler-dummy.c:5:0: /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/profiler.c: In function ‘profiler_tsms’: /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/profiler.c:124:22: error: old-style function definition [-Werror=old-style-definition] static unsigned long profiler_tsms() { ^ /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/profiler.c: In function ‘profiler_clearbar’: /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/profiler.c:134:6: error: old-style function definition [-Werror=old-style-definition] void profiler_clearbar() { ^ /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/profiler.c:136:2: error: ‘for’ loop initial declarations are only allowed in C99 mode for (int bs=0; bs < PROFILER_BARSYMB + 3 + 6; bs++) printf("\b \b"); ^ /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/profiler.c:136:2: note: use option -std=c99 or -std=gnu99 to compile your code /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/profiler.c: In function ‘profiler_thread’: /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/profiler.c:160:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] char buf[BUFSIZ]; ^ /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/profiler.c:188:4: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] size_t i = 0, j = 0; ^ /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/profiler.c:226:1: error: no return statement in function returning non-void [-Werror=return-type] } ^ /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/profiler.c: In function ‘profiler_arm’: /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/profiler.c:232:6: error: old-style function definition [-Werror=old-style-definition] void profiler_arm() { ^ /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/profiler.c: In function ‘profiler_start’: /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/profiler.c:236:5: error: old-style function definition [-Werror=old-style-definition] int profiler_start() { ^ /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/profiler.c:243:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] struct sockaddr_in serv_addr; ^ /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/profiler.c:258:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] char* ctype = getenv("LC_CTYPE"); ^ /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/profiler.c:261:26: error: universal character names are only valid in C++ and C99 [-Werror] profiler_symb_query = "\u27F2"; ^ /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/profiler.c:262:25: error: universal character names are only valid in C++ and C99 [-Werror] profiler_symb_trans = "\u2193"; ^ /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/profiler.c:263:25: error: universal character names are only valid in C++ and C99 [-Werror] profiler_symb_bfree = "\u2591"; ^ /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/profiler.c:264:25: error: universal character names are only valid in C++ and C99 [-Werror] profiler_symb_bfull = "\u2588"; ^ cc1: all warnings being treated as errors make[5]: *** [profiler-dummy.o] Error 1 make[5]: Leaving directory `/net/rome.ins.cwi.nl/export/scratch1/manegold/Monet/HG/default/builds/_/clients/mapiclient' ======== Stefan ----- Original Message -----
This might be an UGLY workaround:
======== diff -r 25b951244aff clients/mapiclient/Makefile.ag --- a/clients/mapiclient/Makefile.ag Tue Feb 24 10:17:03 2015 +0100 +++ b/clients/mapiclient/Makefile.ag Tue Feb 24 11:06:34 2015 +0100 @@ -16,7 +16,7 @@ # All Rights Reserved.
MTSAFE -INCLUDES = ../mapilib ../../common/options ../../common/stream ../R/MonetDB.R/src/ $(READLINE_INCS) +INCLUDES = ../mapilib ../../common/options ../../common/stream -I$(srcdir)/../R/MonetDB.R/src/ $(READLINE_INCS)
lib_mcutil = { NOINST ========
(mind that our autogen magic indeed requires the -I in this case (only) ...)
Stefan
----- Original Message -----
This fails to compile, at least when BUILDDIR != SOURCEDIR:
======== make[5]: Entering directory `/net/rome.ins.cwi.nl/export/scratch1/manegold/Monet/HG/default/builds/_/clients/mapiclient' /bin/sh ../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I/ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient -I../.. -I/ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient -I../mapilib -I/ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../mapilib -I../../common/options -I/ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../../common/options -I../../common/stream -I/ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../../common/stream -I../R/MonetDB.R/src/ -I/ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/ -DLIBMCUTIL -g -Werror -Wall -Wextra -W -Werror-implicit-function-declaration -Wpointer-arith -Wdeclaration-after-statement -Wundef -Wformat=2 -Wno-format-nonliteral -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-format-attribute -Wmissing-prototypes -Wold-style-definition -Wpacked -Wunknown-pragmas -Wvariadic-macros -fstack-! protector -all -Wstack-protector -Wpacked-bitfield-compat -Wsync-nand -Wjump-misses-init -Wmissing-include-dirs -Wlogical-op -Wunreachable-code -D_REENTRANT -c -o libmcutil_la-dump.lo `test -f 'dump.c' || echo '/ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/'`dump.c libtool: compile: gcc -DHAVE_CONFIG_H -I. -I/ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient -I../.. -I/ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient -I../mapilib -I/ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../mapilib -I../../common/options -I/ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../../common/options -I../../common/stream -I/ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../../common/stream -I../R/MonetDB.R/src/ -I/ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/../R/MonetDB.R/src/ -DLIBMCUTIL -g -Werror -Wall -Wextra -W -Werror-implicit-function-declaration -Wpointer-arith -Wdeclaration-after-statement -Wundef -Wformat=2 -Wno-format-nonliteral -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-format-attribute -Wmissing-prototypes -Wold-style-definition -Wpacked -Wunknown-pragmas -Wvariadic-macros -fstack-protector-all -Wstack-protector -! Wpacked-b itfield-compat -Wsync-nand -Wjump-misses-init -Wmissing-include-dirs -Wlogical-op -Wunreachable-code -D_REENTRANT -c /ufs/manegold/_/Monet/HG/default/source/MonetDB/clients/mapiclient/dump.c -fPIC -DPIC -o .libs/libmcutil_la-dump.o cc1: error: ../R/MonetDB.R/src/: No such file or directory [-Werror] cc1: all warnings being treated as errors make[5]: *** [libmcutil_la-dump.lo] Error 1 make[5]: Leaving directory `/net/rome.ins.cwi.nl/export/scratch1/manegold/Monet/HG/default/builds/_/clients/mapiclient' ========
Stefan
----- Original Message -----
Changeset: 18471e6cd453 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=18471e6cd453 Added Files: clients/mapiclient/mapisplit-dummy.c clients/mapiclient/profiler-dummy.c Modified Files: clients/mapiclient/Makefile.ag clients/mapiclient/mclient.c Branch: default Log Message:
mclient progress meter part one, mal statement progress
diffs (148 lines):
diff --git a/clients/mapiclient/Makefile.ag b/clients/mapiclient/Makefile.ag --- a/clients/mapiclient/Makefile.ag +++ b/clients/mapiclient/Makefile.ag @@ -16,7 +16,7 @@ # All Rights Reserved.
MTSAFE -INCLUDES = ../mapilib ../../common/options ../../common/stream $(READLINE_INCS) +INCLUDES = ../mapilib ../../common/options ../../common/stream ../R/MonetDB.R/src/ $(READLINE_INCS)
lib_mcutil = { NOINST @@ -24,7 +24,7 @@ lib_mcutil = { }
bin_mclient = { - SOURCES = mclient.c ReadlineTools.c ReadlineTools.h + SOURCES = mclient.c ReadlineTools.c ReadlineTools.h mapisplit-dummy.c profiler-dummy.c LIBS = libmcutil ../mapilib/libmapi \ ../../common/stream/libstream \ $(READLINE_LIBS) \ diff --git a/clients/mapiclient/mapisplit-dummy.c b/clients/mapiclient/mapisplit-dummy.c new file mode 100644 --- /dev/null +++ b/clients/mapiclient/mapisplit-dummy.c @@ -0,0 +1,5 @@ +/* +This refers to ../R/MonetDB.R/src/mapisplit.c . We cannot have this file here, +as the R connector needs to be able to compile stand-alone. +*/ +#include "mapisplit.c" \ No newline at end of file diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c --- a/clients/mapiclient/mclient.c +++ b/clients/mapiclient/mclient.c @@ -78,6 +78,8 @@ #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #endif
+#include "profiler.h" + enum modes { MAL, SQL, @@ -1934,14 +1936,13 @@ doFileBulk(Mapi mid, FILE *fp) } } timerResume(); - if (hdl == NULL) { hdl = mapi_query_prep(mid); CHECK_RESULT(mid, hdl, buf, continue, buf); }
assert(hdl != NULL); - + profiler_arm(); mapi_query_part(hdl, buf, length); CHECK_RESULT(mid, hdl, buf, continue, buf);
@@ -2722,6 +2723,8 @@ doFile(Mapi mid, const char *file, int u
if (hdl == NULL) { timerStart(); + profiler_arm(); + hdl = mapi_query_prep(mid); CHECK_RESULT(mid, hdl, buf, continue, buf); } else @@ -2861,6 +2864,7 @@ usage(const char *prog, int xit) fprintf(stderr, " -w nr | --width=nr for pagination\n"); fprintf(stderr, " -D | --dump create an SQL dump\n"); fprintf(stderr, " -N | --inserts use INSERT INTO statements when dumping\n"); + fprintf(stderr, " -P | --progress show progress bar\n"); fprintf(stderr, "The file argument can be - for stdin\n"); exit(xit); } @@ -2887,6 +2891,7 @@ main(int argc, char **argv) int interactive = 0; int has_fileargs = 0; int option_index = 0; + int progress = 0; int settz = 1; int autocommit = 1; /* autocommit mode default on */ struct stat statb; @@ -2912,6 +2917,7 @@ main(int argc, char **argv) {"pager", 1, 0, '|'}, #endif {"port", 1, 0, 'p'}, + {"progress", 0, 0, 'P'}, {"rows", 1, 0, 'r'}, {"statement", 1, 0, 's'}, #if 0 @@ -2970,7 +2976,7 @@ main(int argc, char **argv) #if 0 "t" #endif - "w:r:p:s:Xu:vzH?", + "w:r:p:s:Xu:vzHP?", long_options, &option_index)) != -1) { switch (c) { case 0: @@ -3114,6 +3120,9 @@ main(int argc, char **argv) case 'z': settz = 0; break; + case 'P': + progress = 1; + break; case '?': /* a bit of a hack: look at the option that the * current `c' is based on and see if we recognize @@ -3226,6 +3235,16 @@ main(int argc, char **argv) } }
+ // switch on progress bars + if (mode == SQL && progress) { + char* buf = malloc(100); + int port = profiler_start(); + sprintf(buf, "CALL profiler_openstream('127.0.0.1', %d)", port); + mapi_query(mid, buf); + sprintf(buf, "CALL profiler_stethoscope(0)"); + mapi_query(mid, buf); + } + /* give the user a welcome message with some general info */ if (!has_fileargs && command == NULL && isatty(fileno(stdin))) { char *lang; @@ -3296,6 +3315,7 @@ main(int argc, char **argv) /* execute from command-line, need interactive to know whether * to keep the mapi handle open */ timerStart(); + profiler_arm(); c = doRequest(mid, command); timerEnd(); } diff --git a/clients/mapiclient/profiler-dummy.c b/clients/mapiclient/profiler-dummy.c new file mode 100644 --- /dev/null +++ b/clients/mapiclient/profiler-dummy.c @@ -0,0 +1,5 @@ +/* +This refers to ../R/MonetDB.R/src/profiler.c . We cannot have this file here, +as the R connector needs to be able to compile stand-alone. +*/ +#include "profiler.c" \ No newline at end of file _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
-- | Stefan.Manegold@CWI.nl | DB Architectures (DA) | | www.CWI.nl/~manegold/ | Science Park 123 (L321) | | +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |
_______________________________________________ developers-list mailing list developers-list@monetdb.org https://www.monetdb.org/mailman/listinfo/developers-list
-- | Stefan.Manegold@CWI.nl | DB Architectures (DA) | | www.CWI.nl/~manegold/ | Science Park 123 (L321) | | +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |
_______________________________________________ developers-list mailing list developers-list@monetdb.org https://www.monetdb.org/mailman/listinfo/developers-list
-- | Stefan.Manegold@CWI.nl | DB Architectures (DA) | | www.CWI.nl/~manegold/ | Science Park 123 (L321) | | +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |