Changeset: 700917220ef6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/700917220ef6
Modified Files:
gdk/gdk_bat.c
gdk/gdk_sketch.c
monetdb5/mal/mal_interpreter.c
Branch: default
Log Message:
Add some more debug logging.
diffs (182 lines):
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -695,10 +695,12 @@ wrongtype(int t1, int t2)
BAT *
COLcopy2(BAT *b, int tt, bool writable, bool mayshare, role_t role)
{
+ lng t0 = GDKusec();
bool slowcopy = false;
BAT *bn = NULL;
BATiter bi;
char strhash[GDK_STRHASHSIZE];
+ const char *algo = NULL;
BATcheck(b, NULL);
@@ -832,6 +834,7 @@ COLcopy2(BAT *b, int tt, bool writable,
/* case (2): a void,void result => nothing to
* copy! */
bn->theap->free = 0;
+ algo = "void";
} else if (!slowcopy) {
/* case (3): just copy the heaps */
if (bn->tvheap) {
@@ -843,6 +846,7 @@ COLcopy2(BAT *b, int tt, bool writable,
bn->tvheap = bi.vh;
bn->tvkey = bi.vkey;
bn->tascii = bi.ascii;
+ algo = "share vheap, memcpy heap";
}
} else {
if (HEAPextend(bn->tvheap, bi.vhfree, true) !=
GDK_SUCCEED)
@@ -854,6 +858,7 @@ COLcopy2(BAT *b, int tt, bool writable,
bn->tascii = bi.ascii;
if (ATOMstorage(b->ttype) == TYPE_str &&
bi.vhfree >= GDK_STRHASHSIZE)
memcpy(bn->tvheap->base, strhash,
GDK_STRHASHSIZE);
+ algo = "memcpy vheap and heap";
}
}
memcpy(bn->theap->base, bi.base, bi.hfree);
@@ -867,7 +872,7 @@ COLcopy2(BAT *b, int tt, bool writable,
bn->batCapacity = (BUN) (bn->theap->size >> bn->tshift);
else
bn->batCapacity = 0;
- } else if (tt != TYPE_void || ATOMextern(tt)) {
+ } else if (ATOMextern(tt)) {
/* case (4): one-by-one BUN insert (really slow) */
QryCtx *qry_ctx = MT_thread_get_qry_ctx();
@@ -880,7 +885,8 @@ COLcopy2(BAT *b, int tt, bool writable,
}
TIMEOUT_CHECK(qry_ctx,
GOTO_LABEL_TIMEOUT_HANDLER(bunins_failed, qry_ctx));
bn->theap->dirty |= bi.count > 0;
- } else if (tt != TYPE_void && bi.type == TYPE_void) {
+ algo = "insert values";
+ } else if (bi.type == TYPE_void) {
/* case (4): optimized for unary void
* materialization */
oid cur = bi.tseq, *dst = (oid *) Tloc(bn, 0);
@@ -892,6 +898,7 @@ COLcopy2(BAT *b, int tt, bool writable,
}
bn->theap->free = bi.count * sizeof(oid);
bn->theap->dirty |= bi.count > 0;
+ algo = "materialize void";
} else if (ATOMstorage(bi.type) == TYPE_msk) {
/* convert number of bits to number of bytes,
* and round the latter up to a multiple of
@@ -899,11 +906,13 @@ COLcopy2(BAT *b, int tt, bool writable,
bn->theap->free = ((bi.count + 31) / 32) * 4;
memcpy(Tloc(bn, 0), bi.base, bn->theap->free);
bn->theap->dirty |= bi.count > 0;
+ algo = "memcpy msk";
} else {
/* case (4): optimized for simple array copy */
bn->theap->free = bi.count << bn->tshift;
memcpy(Tloc(bn, 0), bi.base, bn->theap->free);
bn->theap->dirty |= bi.count > 0;
+ algo = "memcpy heap";
}
/* copy all properties (size+other) from the source bat */
BATsetcount(bn, bi.count);
@@ -976,8 +985,8 @@ COLcopy2(BAT *b, int tt, bool writable,
bat_iterator_end(&bi);
if (!writable)
bn->batRestricted = BAT_READ;
- TRC_DEBUG(ALGO, ALGOBATFMT " -> " ALGOBATFMT "\n",
- ALGOBATPAR(b), ALGOBATPAR(bn));
+ TRC_DEBUG(ALGO, ALGOBATFMT " -> " ALGOBATFMT " (%s) " LLFMT " usec\n",
+ ALGOBATPAR(b), ALGOBATPAR(bn), algo, GDKusec() - t0);
return bn;
bunins_failed:
bat_iterator_end(&bi);
diff --git a/gdk/gdk_sketch.c b/gdk/gdk_sketch.c
--- a/gdk/gdk_sketch.c
+++ b/gdk/gdk_sketch.c
@@ -9,6 +9,7 @@
*/
#include "gdk.h"
+#include "gdk_private.h"
#if defined(HAVE_GETENTROPY) && defined(HAVE_SYS_RANDOM_H)
#include <sys/random.h>
#endif
@@ -180,6 +181,7 @@ int
sketch_populate(BAT *b, BATiter *bi, struct canditer *bci,
uint8_t cnting_sketch[BUCKETS][CLZ_BUCKETS])
{
+ lng t0 = GDKusec();
gdk_return rc = GDK_SUCCEED;
QryCtx *qry_ctx = MT_thread_get_qry_ctx();
@@ -229,6 +231,8 @@ sketch_populate(BAT *b, BATiter *bi, str
if (bi == NULL)
bat_iterator_end(&n_bi);
+ TRC_DEBUG(ALGO, ALGOBATFMT " " LLFMT " usec\n", ALGOBATPAR(b),
+ GDKusec() - t0);
return rc;
}
@@ -247,6 +251,7 @@ sketch_populate(BAT *b, BATiter *bi, str
double
bat_guess_uniques(BAT *b, BATiter *bi, struct canditer *bci)
{
+ lng t0 = GDKusec();
uint8_t cnting_sketch[BUCKETS][CLZ_BUCKETS] = {0};
double unique_guess = 0;
@@ -258,5 +263,7 @@ bat_guess_uniques(BAT *b, BATiter *bi, s
unique_guess = sketch_estimate(cnting_sketch);
b->tunique_est = unique_guess;
+ TRC_DEBUG(ALGO, ALGOBATFMT " " LLFMT " usec\n", ALGOBATPAR(b),
+ GDKusec() - t0);
return unique_guess;
}
diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -695,11 +695,16 @@ runMALsequence(Client cntxt, MalBlkPtr m
"address of pattern %s.%s missing",
pci->modname, pci->fcnname);
} else {
+ lng t0 = GDKusec();
TRC_INFO(ALGO, "calling %s.%s\n",
pci->modname ? pci->modname :
"<null>",
pci->fcnname ? pci->fcnname :
"<null>");
ret = (*(str (*) (Client, MalBlkPtr, MalStkPtr,
InstrPtr)) pci->
fcn) (cntxt, mb, stk, pci);
+ TRC_DEBUG(ALGO, "done calling %s.%s " LLFMT "
usec\n",
+ pci->modname ? pci->modname :
"<null>",
+ pci->fcnname ? pci->fcnname :
"<null>",
+ GDKusec() - t0);
#ifndef NDEBUG
if (ret == MAL_SUCCEED) {
/* check that the types of actual
results match
@@ -725,11 +730,16 @@ runMALsequence(Client cntxt, MalBlkPtr m
#endif
}
break;
- case CMDcall:
+ case CMDcall: {
+ lng t0 = GDKusec();
TRC_DEBUG(ALGO, "calling %s.%s\n",
pci->modname ? pci->modname :
"<null>",
pci->fcnname ? pci->fcnname :
"<null>");
ret = malCommandCall(cntxt, stk, pci);
+ TRC_DEBUG(ALGO, "done calling %s.%s " LLFMT "
usec\n",
+ pci->modname ? pci->modname :
"<null>",
+ pci->fcnname ? pci->fcnname :
"<null>",
+ GDKusec() - t0);
#ifndef NDEBUG
if (ret == MAL_SUCCEED) {
/* check that the types of actual results match
@@ -752,6 +762,7 @@ runMALsequence(Client cntxt, MalBlkPtr m
}
#endif
break;
+ }
case FCNcall: {
/*
* MAL function calls are relatively expensive,
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]