Changeset: 7db7f5fd86f6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7db7f5fd86f6
Modified Files:
gdk/gdk_system.c
gdk/gdk_system.h
Branch: Apr2019
Log Message:
When assertion are on, record name of thread that gets the lock.
diffs (46 lines):
diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c
--- a/gdk/gdk_system.c
+++ b/gdk/gdk_system.c
@@ -131,18 +131,19 @@ GDKlockstatistics(int what)
return;
}
GDKlocklist = sortlocklist(GDKlocklist);
- fprintf(stderr, "# lock
name\tcount\tcontention\tsleep\tlocked\t(un)locker\n");
+ fprintf(stderr, "# lock
name\tcount\tcontention\tsleep\tlocked\t(un)locker\tthread\n");
for (l = GDKlocklist; l; l = l->next) {
n++;
if (what == 0 ||
(what == 1 && l->count) ||
(what == 2 && l->contention) ||
(what == 3 && l->lock))
- fprintf(stderr, "# %-18s\t%zu\t%zu\t%zu\t%s\t%s\n",
+ fprintf(stderr, "# %-18s\t%zu\t%zu\t%zu\t%s\t%s\t%s\n",
l->name ? l->name : "unknown",
l->count, l->contention, l->sleep,
l->lock ? "locked" : "",
- l->locker ? l->locker : "");
+ l->locker ? l->locker : "",
+ l->thread ? l->thread : "");
}
fprintf(stderr, "#number of locks %d\n", n);
fprintf(stderr, "#total lock count %zu\n", (size_t) GDKlockcnt);
diff --git a/gdk/gdk_system.h b/gdk/gdk_system.h
--- a/gdk/gdk_system.h
+++ b/gdk/gdk_system.h
@@ -216,6 +216,7 @@ typedef struct MT_Lock {
struct MT_Lock * volatile next;
const char *name;
const char *locker;
+ const char *thread;
#endif
} MT_Lock;
@@ -230,7 +231,7 @@ gdk_export ATOMIC_TYPE volatile GDKlockc
gdk_export ATOMIC_TYPE volatile GDKlockcontentioncnt;
gdk_export ATOMIC_TYPE volatile GDKlocksleepcnt;
#define _DBG_LOCK_COUNT_0(l, n) (void) ATOMIC_INC(GDKlockcnt,
dummy)
-#define _DBG_LOCK_LOCKER(l, n) ((l)->locker = (n))
+#define _DBG_LOCK_LOCKER(l, n) ((l)->locker = (n), (l)->thread =
MT_thread_name())
#define _DBG_LOCK_CONTENTION(l, n) \
do { \
TEMDEBUG fprintf(stderr, "#lock %s contention in %s\n", \
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list