Changeset: f21a41797bb2 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f21a41797bb2
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
clients/Tests/exports.stable.out
gdk/gdk_system.c
gdk/gdk_system.h
monetdb5/mal/mal_dataflow.c
Branch: mosaic
Log Message:
Merge with default
diffs (295 lines):
diff --git a/clients/Tests/MAL-signatures.stable.out
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -40859,7 +40859,7 @@ pattern sql.sysmon_pause(tag:sht):void
address SYSMONpause;
pattern sql.sysmon_queue()
(qtag:bat[:oid,:lng],user:bat[:oid,:str],started:bat[:oid,:timestamp],estimate:bat[:oid,:timestamp],progress:bat[:oid,:int],status:bat[:oid,:str],tag:bat[:oid,:oid],query:bat[:oid,:str])
address SYSMONqueue;
-pattern sql.storage()
(schema:bat[:oid,:str],table:bat[:oid,:str],column:bat[:oid,:str],type:bat[:oid,:str],mode:bat[:oid,:str],location:bat[:oid,:str],count:bat[:oid,:lng],atomwidth:bat[:oid,:int],columnsize:bat[:oid,:lng],heap:bat[:oid,:lng],hashes:bat[:oid,:lng],imprints:bat[:oid,:lng],sorted:bat[:oid,:bit])
+pattern sql.storage()
(schema:bat[:oid,:str],table:bat[:oid,:str],column:bat[:oid,:str],type:bat[:oid,:str],mode:bat[:oid,:str],location:bat[:oid,:str],count:bat[:oid,:lng],atomwidth:bat[:oid,:int],columnsize:bat[:oid,:lng],heap:bat[:oid,:lng],hashes:bat[:oid,:lng],phash:bat[:oid,:bit],imprints:bat[:oid,:lng],sorted:bat[:oid,:bit])
address sql_storage;
comment return a table with storage information
diff --git a/clients/Tests/MAL-signatures.stable.out.int128
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -51802,7 +51802,7 @@ pattern sql.sysmon_pause(tag:sht):void
address SYSMONpause;
pattern sql.sysmon_queue()
(qtag:bat[:oid,:lng],user:bat[:oid,:str],started:bat[:oid,:timestamp],estimate:bat[:oid,:timestamp],progress:bat[:oid,:int],status:bat[:oid,:str],tag:bat[:oid,:oid],query:bat[:oid,:str])
address SYSMONqueue;
-pattern sql.storage()
(schema:bat[:oid,:str],table:bat[:oid,:str],column:bat[:oid,:str],type:bat[:oid,:str],mode:bat[:oid,:str],location:bat[:oid,:str],count:bat[:oid,:lng],atomwidth:bat[:oid,:int],columnsize:bat[:oid,:lng],heap:bat[:oid,:lng],hashes:bat[:oid,:lng],imprints:bat[:oid,:lng],sorted:bat[:oid,:bit])
+pattern sql.storage()
(schema:bat[:oid,:str],table:bat[:oid,:str],column:bat[:oid,:str],type:bat[:oid,:str],mode:bat[:oid,:str],location:bat[:oid,:str],count:bat[:oid,:lng],atomwidth:bat[:oid,:int],columnsize:bat[:oid,:lng],heap:bat[:oid,:lng],hashes:bat[:oid,:lng],phash:bat[:oid,:bit],imprints:bat[:oid,:lng],sorted:bat[:oid,:bit])
address sql_storage;
comment return a table with storage information
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -295,7 +295,6 @@ size_t HEAPvmsize(Heap *h);
lng IMPSimprintsize(BAT *b);
void MRschedule(int taskcnt, void **arg, void( *cmd)(void *p));
int MT_check_nr_cores(void);
-unsigned long long MT_clock(void);
int MT_create_thread(MT_Id *t, void( *function)(void *), void *arg, enum
MT_thr_detach d);
void MT_exiting_thread(void);
MT_Id MT_getpid(void);
@@ -303,11 +302,6 @@ size_t MT_getrss(void);
void MT_init(void);
int MT_join_thread(MT_Id t);
int MT_lockf(char *filename, int mode, off_t off, off_t len);
-MT_Id MT_locktrace;
-unsigned long long MT_locktrace_cnt[65536];
-void MT_locktrace_end(void);
-char *MT_locktrace_nme[65536];
-void MT_locktrace_start(void);
struct Mallinfo MT_mallinfo(void);
void *MT_mmap(const char *path, int mode, size_t len);
int MT_munmap(void *p, size_t len);
diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c
--- a/gdk/gdk_system.c
+++ b/gdk/gdk_system.c
@@ -150,74 +150,6 @@ GDKlockstatistics(int what)
}
#endif
-#ifdef MT_LOCK_TRACE
-unsigned long long MT_locktrace_cnt[65536] = { 0 };
-char *MT_locktrace_nme[65536] = { NULL };
-
-#if defined(ia64) && !defined(__GNUC__)
-#include "ia64regs.h"
-#endif
-
-unsigned long long
-MT_clock()
-{
- unsigned long long tsc;
-
-#if defined(__x86_64__) && !defined(__PGI)
- unsigned long long a, d;
- __asm__ __volatile__("rdtsc":"=a"(a), "=d"(d));
-
- tsc = ((unsigned long) a) | (((unsigned long) d) << 32);
-#define TICKNAME "rdtsc "
-#elif defined(__i386__) && !defined(__PGI)
- __asm__ __volatile__("rdtsc":"=A"(tsc));
-
-#define TICKNAME "rdtsc "
-#elif !defined(ia64)
- tsc = (unsigned long long) clock();
-#define TICKNAME "clock "
-#elif defined(__GNUC__)
- __asm__ __volatile__("mov %0=ar.itc":"=r"(tsc)::"memory");
-
-#define TICKNAME "ar.itc"
-#else
- tsc = (unsigned long long) __getReg(_IA64_REG_AR_ITC);
-#define TICKNAME "AR_ITC"
-#endif /* defined(i386) */
- return tsc;
-}
-MT_Id MT_locktrace = 0;
-
-void
-MT_locktrace_start()
-{
- memset(MT_locktrace_cnt, 0, 65536 * sizeof(unsigned long long));
- MT_locktrace = MT_getpid();
-}
-
-void
-MT_locktrace_end()
-{
- unsigned long long my_cnt[65536];
- memset(my_cnt, 0, 65536 * sizeof(unsigned long long));
- for (int i = 0; i < 65536; i++)
- if (MT_locktrace_cnt[i]) {
- int idx = MT_locktrace_hash(MT_locktrace_nme[i]);
-
- my_cnt[idx] += MT_locktrace_cnt[i];
- }
- for (int i = 0; i < 65536; i++)
- if (MT_locktrace_cnt[i]) {
- int idx = MT_locktrace_hash(MT_locktrace_nme[i]);
-
- if (my_cnt[idx])
- fprintf(stderr, "%s " ULLFMT "\n",
MT_locktrace_nme[i], my_cnt[idx]);
- my_cnt[idx] = 0;
- }
- MT_locktrace = 0;
-}
-#endif /* MT_LOCK_TRACE */
-
#if !defined(HAVE_PTHREAD_H) && defined(_MSC_VER)
static struct winthread {
struct winthread *next;
diff --git a/gdk/gdk_system.h b/gdk/gdk_system.h
--- a/gdk/gdk_system.h
+++ b/gdk/gdk_system.h
@@ -63,50 +63,6 @@ gdk_export int gprof_pthread_create(pthr
/* debug and errno integers */
gdk_export int GDKdebug;
-/* lock performance tracing */
-/* #define MT_LOCK_TRACE 1 */
-#ifdef MT_LOCK_TRACE
-gdk_export MT_Id MT_locktrace;
-gdk_export void MT_locktrace_start(void);
-gdk_export void MT_locktrace_end(void);
-gdk_export unsigned long long MT_locktrace_cnt[65536];
-gdk_export char *MT_locktrace_nme[65536];
-gdk_export unsigned long long MT_clock(void);
-
-#define MT_locktrace_hash(_id) ((int) (((lng) ((size_t) (_id))) ^ (((lng)
((size_t) (_id))) >> 16)) & 65535)
-#define MT_log_trace(_impl, _object, _action, _caller, _fp, _pat) \
- do { \
- unsigned long long _c=0; \
- if (MT_locktrace) \
- _c = MT_getpid() == MT_locktrace ? MT_clock() : 0; \
- MT_log(_impl, _object, _action, _caller, _fp); \
- if (_c) \
- MT_locktrace_cnt[MT_locktrace_hash(_pat)] += MT_clock()
- _c; \
- } while(0)
-#define MT_locktrace_set(s, n) \
- do { \
- int _i = MT_locktrace_hash(s); \
- if (MT_locktrace_nme[_i] && MT_locktrace_nme[_i] != (n)) { \
- fprintf(stderr, "MT_locktrace: name collision %s hides
%s\n", \
- MT_locktrace_nme[_i], (n)); \
- } else \
- MT_locktrace_nme[_i] = (n); \
- } while (0)
-#else
-#define MT_log_trace(_impl, _object, _action, _caller, _fp, _pat)
MT_log(_impl, _object, _action, _caller, _fp)
-#define MT_locktrace_set(s, n)
-#endif
-
-#define MT_log(_impl, _object, _action, _caller, _fp) \
- do { \
- TEMDEBUG { \
- fprintf(_fp, "%s: " _action "(" PTRFMT ")\n", \
- _caller, PTRFMTCAST(void*) _object); \
- fflush(_fp); \
- } \
- _impl; \
- } while (0)
-
/* API */
/*
@@ -157,21 +113,34 @@ gdk_export int pthread_mutex_unlock(pthr
#ifdef USE_PTHREAD_LOCKS
-typedef pthread_mutex_t MT_Lock;
+typedef struct {
+ pthread_mutex_t lock;
+ const char *name;
+} MT_Lock;
-#define MT_lock_init(l, n) \
- do { \
- pthread_mutex_init((pthread_mutex_t*) (l), 0); \
- MT_locktrace_set(l, n); \
+#define MT_lock_init(l, n) \
+ do { \
+ (l)->name = (n); \
+ pthread_mutex_init(&(l)->lock, 0); \
} while (0)
-#define MT_lock_destroy(l) pthread_mutex_destroy((pthread_mutex_t*) (l))
-#define MT_lock_set(l, n)
MT_log_trace(pthread_mutex_lock((pthread_mutex_t *) (l)), (l), "MT_set_lock",
n, stderr, (l))
-#define MT_lock_unset(l, n) MT_log(pthread_mutex_unlock((pthread_mutex_t *)
(l)), (l), "MT_unset_lock", n, stderr)
-#define MT_lock_try(l) pthread_mutex_trylock((pthread_mutex_t *) (l))
-#define MT_lock_dump(l, fp, n) MT_log(/*nothing*/, &(l), "MT_dump_lock", n, fp)
+#define MT_lock_destroy(l) pthread_mutex_destroy(&(l)->lock)
+#define MT_lock_set(l, n) \
+ do { \
+ TEMDEBUG fprintf(stderr, "#%s: locking %s...\n", \
+ (n), (l)->name); \
+ pthread_mutex_lock(&(l)->lock); \
+ TEMDEBUG fprintf(stderr, "#%s: locking %s complete\n", \
+ (n), (l)->name); \
+ } while (0)
+#define MT_lock_unset(l, n) \
+ do { \
+ TEMDEBUG fprintf(stderr, "#%s: unlocking %s\n", \
+ (n), (l)->name); \
+ pthread_mutex_unlock(&(l)->lock); \
+ } while (0)
#ifdef PTHREAD_MUTEX_INITIALIZER
-#define MT_LOCK_INITIALIZER(name) = PTHREAD_MUTEX_INITIALIZER
+#define MT_LOCK_INITIALIZER(name) = { PTHREAD_MUTEX_INITIALIZER, name }
#else
/* no static initialization possible, so we need dynamic initialization */
#define MT_LOCK_INITIALIZER(name)
@@ -208,7 +177,8 @@ gdk_export ATOMIC_TYPE volatile GDKlocks
#define _DBG_LOCK_LOCKER(l, n) ((l)->locker = (n))
#define _DBG_LOCK_CONTENTION(l, n) \
do { \
- TEMDEBUG fprintf(stderr, "#lock %s contention in %s\n",
(l)->name, n); \
+ TEMDEBUG fprintf(stderr, "#lock %s contention in %s\n", \
+ (l)->name, n); \
(void) ATOMIC_INC(GDKlockcontentioncnt, dummy, n); \
(l)->contention++; \
} while (0)
@@ -314,8 +284,6 @@ gdk_export ATOMIC_TYPE volatile GDKlocks
ATOMIC_CLEAR((l)->lock, dummy, n); \
} while (0)
#define MT_lock_destroy(l) _DBG_LOCK_DESTROY(l)
-/* return 0 on success, -1 on failure to get the lock */
-#define MT_lock_try(l) ((ATOMIC_TAS((l)->lock, dummy, dummy) == 0) - 1)
#endif
@@ -353,16 +321,31 @@ gdk_export void pthread_sema_down(pthrea
#endif
-typedef pthread_sema_t MT_Sema;
+typedef struct {
+ pthread_sema_t sema;
+ const char *name;
+} MT_Sema;
-#define MT_sema_init(s, nr, n) \
- do { \
- pthread_sema_init((s), 0, nr); \
- MT_locktrace_set((s), n); \
+#define MT_sema_init(s, nr, n) \
+ do { \
+ (s)->name = (n); \
+ pthread_sema_init(&(s)->sema, 0, nr); \
} while (0)
-#define MT_sema_destroy(s) pthread_sema_destroy(s)
-#define MT_sema_up(s, n) MT_log(pthread_sema_up(s), (s), "MT_up_sema",
n, stderr)
-#define MT_sema_down(s, n) MT_log_trace(pthread_sema_down(s), (s),
"MT_down_sema", n, stderr, s)
+#define MT_sema_destroy(s) pthread_sema_destroy(&(s)->sema)
+#define MT_sema_up(s, n) \
+ do { \
+ TEMDEBUG fprintf(stderr, "#%s: sema %s up\n", \
+ (n), (s)->name); \
+ pthread_sema_up(&(s)->sema); \
+ } while (0)
+#define MT_sema_down(s, n) \
+ do { \
+ TEMDEBUG fprintf(stderr, "#%s: sema %s down...\n", \
+ (n), (s)->name); \
+ pthread_sema_down(&(s)->sema); \
+ TEMDEBUG fprintf(stderr, "#%s: sema %s down complete\n", \
+ (n), (s)->name); \
+ } while (0)
gdk_export int MT_check_nr_cores(void);
diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c
--- a/monetdb5/mal/mal_dataflow.c
+++ b/monetdb5/mal/mal_dataflow.c
@@ -126,7 +126,6 @@ q_create(int sz, const char *name)
}
q->exitcount = 0;
- (void) name; /* in case MT_LOCK_TRACE is not enabled in gdk_system.h */
MT_lock_init(&q->l, name);
MT_sema_init(&q->s, 0, name);
return q;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list