Changeset: 010627962c38 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=010627962c38 Added Files: MonetDB5/modules/mal/Makefile.ag MonetDB5/modules/mal/mal_init.mal MonetDB5/modules/mal/tracer.c MonetDB5/modules/mal/tracer.h MonetDB5/modules/mal/tracer.mal sql/scripts/81_tracer.sql Modified Files: gdk/gdk_tracer.c gdk/gdk_tracer.h sql/scripts/Makefile.ag Branch: gdk-tracer Log Message:
SQL API for GDKtracer diffs (truncated from 737 to 300 lines): diff --git a/MonetDB5/modules/mal/Makefile.ag b/MonetDB5/modules/mal/Makefile.ag new file mode 100644 --- /dev/null +++ b/MonetDB5/modules/mal/Makefile.ag @@ -0,0 +1,85 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. + +INCLUDES = ../../mal ../atoms ../kernel \ + ../../../clients/mapilib \ + ../../../common/stream \ + ../../../common/utils \ + ../../../gdk \ + $(pcre_CFLAGS) $(MSGCONTROL_FLAGS) \ + $(openssl_CFLAGS) + +MTSAFE + +lib_mal = { + NOINST + SOURCES = \ + batExtensions.c batExtensions.h \ + bbp.c bbp.h \ + clients.c clients.h \ + factories.c factories.h \ + groupby.c groupby.h \ + inspect.c inspect.h \ + orderidx.c orderidx.h \ + iterator.c iterator.h \ + projectionpath.c projectionpath.h \ + language.c language.h \ + mal_io.c mal_io.h \ + mal_mapi.c mal_mapi.h \ + manual.c manual.h \ + mat.c mat.h \ + mdb.c mdb.h \ + mkey.c mkey.h \ + manifold.c manifold.h \ + oltp.c oltp.h \ + wlc.c wlc.h \ + pcre.c \ + profiler.c profiler.h \ + querylog.c querylog.h \ + remote.c remote.h \ + sysmon.c sysmon.h \ + tablet.c tablet.h \ + tokenizer.c tokenizer.h \ + transaction.c \ + txtsim.c txtsim.h \ + sample.c sample.h \ + json_util.c json_util.h \ + calc.c batcalc.c \ + tracer.c tracer.h +} + +headers_mal = { + HEADERS = mal + DIR = libdir/monetdb5 + SOURCES = language.mal mal_init.mal bbp.mal \ + profiler.mal batExtensions.mal orderidx.mal \ + inspect.mal manual.mal mal_io.mal mkey.mal manifold.mal \ + iterator.mal clients.mal \ + factories.mal groupby.mal mdb.mal pcre.mal mat.mal \ + transaction.mal oltp.mal wlc.mal \ + mal_mapi.mal remote.mal \ + txtsim.mal \ + tokenizer.mal sample.mal json_util.mal \ + batmtime.mal querylog.mal sysmon.mal \ + tracer.mal +} + +headers_auto = { + HEADERS = mal + DIR = libdir/monetdb5/autoload + SOURCES = 01_calc.mal 01_batcalc.mal +} + +headers_hge = { + COND = HAVE_HGE + HEADERS = mal + DIR = libdir/monetdb5/autoload + SOURCES = 00_calc_hge.mal 00_batcalc_hge.mal \ + 00_iterator_hge.mal 00_language_hge.mal \ + 00_mal_mapi_hge.mal 00_mkey_hge.mal 00_batExtensions_hge.mal +} + +EXTRA_DIST_DIR = Tests diff --git a/MonetDB5/modules/mal/mal_init.mal b/MonetDB5/modules/mal/mal_init.mal new file mode 100644 --- /dev/null +++ b/MonetDB5/modules/mal/mal_init.mal @@ -0,0 +1,96 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. + +# (c) Martin Kersten +# MAL Startup file +# Upon starting the Monet/MAL server we need to initialize the symbol table. +# This encompasses loading the signatures of several key modules. +# They are listed below. +# +# Beware, since libraries are loaded dynamically, there is an implicit +# dependency. For example, the mapi module initializer uses the bat module. +# It should be loaded after the bat module. +# +# The negative effect is that this module is inspected as part of +# the function resolution scheme. +# +# The remainder interprets the signatures and resolves the address bindings. +# The signatures may exists without the corresponding function implementation +# to be loaded. This way, MAL programs can be normally compiled, and only +# upon use of the function will it create the necessary exception. +# +# The order of the includes defines the dependencies. +include mdb; +include alarm; +include mmath; +include streams; +# The kernel stuff to make it work +include bat5; +include batExtensions; +include algebra; +include orderidx; +#include calc; --- moved to autoload/01_calc +include status; +include groupby; +include group; +include aggr; +include mkey; + +# Atom extensions +include blob; +include color; +include str; +include url; +include uuid; +include json; +include json_util; +include mtime; +include inet; +include identifier; +include xml; +include batxml; + +# The hardwired multiplex extensions +include batmmath; +#include batcalc; -- moved to autoload/01_batcalc +include batmtime; +include batstr; +include batcolor; + +# MAL related extensions +include pcre; +include clients; +include bbp; +include mal_io; +include manifold; +include factories; +include remote; + +include mat; +include inspect; +include manual; +include language; + +include profiler; +include querylog; +include sysmon; +include sample; + +include optimizer; + +include iterator; +include txtsim; +include tokenizer; + +include mal_mapi; +include oltp; +include wlc; +include tracer; + +# Any extensions (MAL scripts) that should be automatically loaded upon +# startup can be placed in the autoload directory. One typically finds +# the SQL module in here, but it can also be used to load custom scripts. +include autoload; diff --git a/MonetDB5/modules/mal/tracer.c b/MonetDB5/modules/mal/tracer.c new file mode 100644 --- /dev/null +++ b/MonetDB5/modules/mal/tracer.c @@ -0,0 +1,93 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. + */ + +#include "monetdb_config.h" +#include "tracer.h" +#include "gdk_tracer.h" + + +int GDK_result = 0; + +str +TRACERflush_buffer(void) +{ + GDK_result = GDKtracer_flush_buffer(); + // if(GDK_result == GDK_FAIL) + // throw(TRACER, __FILE__, "%s:%s", __func__, OPERATION_FAILED); + + return MAL_SUCCEED; +} + + +str +TRACERset_component_log_level(void *ret, int *comp, int *lvl) +{ + (void) ret; + GDK_result = GDKtracer_set_component_log_level(comp, lvl); + // if(GDK_result == GDK_FAIL) + // throw(TRACER, __FILE__, "%s:%s", __func__, OPERATION_FAILED); + + return MAL_SUCCEED; +} + + +str +TRACERreset_component_log_level(int *comp) +{ + GDK_result = GDKtracer_reset_component_log_level(comp); + // if(GDK_result == GDK_FAIL) + // throw(TRACER, __FILE__, "%s:%s", __func__, OPERATION_FAILED); + + return MAL_SUCCEED; +} + + +str +TRACERset_flush_level(void *ret, int *lvl) +{ + (void) ret; + GDK_result = GDKtracer_set_flush_level(lvl); + // if(GDK_result == GDK_FAIL) + // throw(TRACER, __FILE__, "%s:%s", __func__, OPERATION_FAILED); + + return MAL_SUCCEED; +} + + +str +TRACERreset_flush_level(void) +{ + GDK_result = GDKtracer_reset_flush_level(); + // if(GDK_result == GDK_FAIL) + // throw(TRACER, __FILE__, "%s:%s", __func__, OPERATION_FAILED); + + return MAL_SUCCEED; +} + + +str +TRACERset_adapter(void *ret, int *adapter) +{ + (void) ret; + GDK_result = GDKtracer_set_adapter(adapter); + // if(GDK_result == GDK_FAIL) + // throw(TRACER, __FILE__, "%s:%s", __func__, OPERATION_FAILED); + + return MAL_SUCCEED; +} + + +str +TRACERreset_adapter(void) +{ + GDK_result = GDKtracer_reset_adapter(); + // if(GDK_result == GDK_FAIL) + // throw(TRACER, __FILE__, "%s:%s", __func__, OPERATION_FAILED); + + return MAL_SUCCEED; +} diff --git a/MonetDB5/modules/mal/tracer.h b/MonetDB5/modules/mal/tracer.h new file mode 100644 --- /dev/null +++ b/MonetDB5/modules/mal/tracer.h @@ -0,0 +1,23 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. _______________________________________________ checkin-list mailing list [email protected] https://www.monetdb.org/mailman/listinfo/checkin-list
