Changeset: 1480e1bdf201 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1480e1bdf201
Modified Files:
gdk/gdk.h
gdk/gdk_bat.c
gdk/gdk_bbp.mx
gdk/gdk_heap.c
gdk/gdk_utils.c
Branch: default
Log Message:
Cleanup: no real code changes.
Fixed up some layout; fixed the type of a variable.
diffs (149 lines):
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -905,7 +905,6 @@ typedef int (*GDKfcn) ();
#define batStamp P->stamp
#define batSharecnt P->sharecnt
#define batRestricted P->restricted
-#define batLastused P->lastused
#define creator_tid P->tid
#define htype H->type
#define ttype T->type
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -2124,27 +2124,28 @@ BATvmsize(BAT *b, int dirty)
BATcheck(b, "BATvmsize");
if (b->batDirty || (b->batPersistence != TRANSIENT &&
!b->batCopiedtodisk))
dirty = 0;
- return ((dirty == 0 || b->H->heap.dirty) ? HEAPvmsize(&b->H->heap) : 0)
+
- ((dirty == 0 || b->T->heap.dirty) ? HEAPvmsize(&b->T->heap) :
0) +
- (((dirty == 0 || b->H->heap.dirty) && b->H->hash) ?
HEAPvmsize(b->H->hash->heap) : 0) +
- (((dirty == 0 || b->T->heap.dirty) && b->T->hash) ?
HEAPvmsize(b->T->hash->heap) : 0) +
- ((b->H->vheap && (dirty == 0 || b->H->vheap->dirty)) ?
HEAPvmsize(b->H->vheap) : 0) +
- ((b->T->vheap && (dirty == 0 || b->T->vheap->dirty)) ?
HEAPvmsize(b->T->vheap) : 0);
+ return (!dirty || b->H->heap.dirty ? HEAPvmsize(&b->H->heap) : 0) +
+ (!dirty || b->T->heap.dirty ? HEAPvmsize(&b->T->heap) : 0) +
+ ((!dirty || b->H->heap.dirty) && b->H->hash ?
HEAPvmsize(b->H->hash->heap) : 0) +
+ ((!dirty || b->T->heap.dirty) && b->T->hash ?
HEAPvmsize(b->T->hash->heap) : 0) +
+ (b->H->vheap && (!dirty || b->H->vheap->dirty) ?
HEAPvmsize(b->H->vheap) : 0) +
+ (b->T->vheap && (!dirty || b->T->vheap->dirty) ?
HEAPvmsize(b->T->vheap) : 0);
}
size_t
BATmemsize(BAT *b, int dirty)
{
BATcheck(b, "BATmemsize");
- if (b->batDirty || (b->batPersistence != TRANSIENT &&
!b->batCopiedtodisk))
+ if (b->batDirty ||
+ (b->batPersistence != TRANSIENT && !b->batCopiedtodisk))
dirty = 0;
- return ((dirty == 0 || b->batDirtydesc) ? sizeof(BATstore) : 0) +
- ((dirty == 0 || b->H->heap.dirty) ? HEAPmemsize(&b->H->heap) :
0) +
- ((dirty == 0 || b->T->heap.dirty) ? HEAPmemsize(&b->T->heap) :
0) +
- (((dirty == 0 || b->H->heap.dirty) && b->H->hash) ?
HEAPmemsize(b->H->hash->heap) : 0) +
- (((dirty == 0 || b->T->heap.dirty) && b->T->hash) ?
HEAPmemsize(b->T->hash->heap) : 0) +
- ((b->H->vheap && (dirty == 0 || b->H->vheap->dirty)) ?
HEAPmemsize(b->H->vheap) : 0) +
- ((b->T->vheap && (dirty == 0 || b->T->vheap->dirty)) ?
HEAPmemsize(b->T->vheap) : 0);
+ return (!dirty || b->batDirtydesc ? sizeof(BATstore) : 0) +
+ (!dirty || b->H->heap.dirty ? HEAPmemsize(&b->H->heap) : 0) +
+ (!dirty || b->T->heap.dirty ? HEAPmemsize(&b->T->heap) : 0) +
+ ((!dirty || b->H->heap.dirty) && b->H->hash ?
HEAPmemsize(b->H->hash->heap) : 0) +
+ ((!dirty || b->T->heap.dirty) && b->T->hash ?
HEAPmemsize(b->T->hash->heap) : 0) +
+ (b->H->vheap && (!dirty || b->H->vheap->dirty) ?
HEAPmemsize(b->H->vheap) : 0) +
+ (b->T->vheap && (!dirty || b->T->vheap->dirty) ?
HEAPmemsize(b->T->vheap) : 0);
}
/*
diff --git a/gdk/gdk_bbp.mx b/gdk/gdk_bbp.mx
--- a/gdk/gdk_bbp.mx
+++ b/gdk/gdk_bbp.mx
@@ -112,7 +112,7 @@ All Rights Reserved.
gdk_export int BBPin; /* BATs swapped into BBP */
gdk_export int BBPout; /* BATs swapped out of BBP */
-gdk_export int BBPsize; /* current occupied size of BBP array */
+gdk_export bat BBPsize; /* current occupied size of BBP array */
/* global calls */
gdk_export bat BBPimportEntry(char *nme);
@@ -2892,13 +2892,8 @@ BBPtrim_scan(bat bbppos, bat bbplim)
* cache miss is relatively
* higher for small bats
*/
- int swap_first = 0;
- BUN cnt = BUN_NONE;
-
- if (b) {
- cnt = BATcount(b);
- swap_first = (cnt >=
BBPSMALLBAT);
- }
+ BUN cnt = BATcount(b);
+ int swap_first = (cnt >= BBPSMALLBAT);
/* however, when we are
* looking to decrease the
@@ -2968,7 +2963,9 @@ BBPtrim_select(size_t target, int dirty)
PTRFMTCAST(void *)b);
THRprintf(GDKstdout,
- "# (cnt=" BUNFMT ", mode=%d,
refs=%d, wait=%d, parent=%d,%d, lastused=%d,%d,%d)\n",
+ "# (cnt=" BUNFMT ", mode=%d, "
+ "refs=%d, wait=%d, parent=%d,%d, "
+ "lastused=%d,%d,%d)\n",
bbptrim[cur].cnt,
b->batPersistence,
BBP_refs(b->batCacheid),
@@ -3163,8 +3160,9 @@ BBPtrim(size_t target)
bbptrim[i].bid);
continue;
}
- MEMDEBUG THRprintf(GDKstdout, "#BBPTRIM: %9d %7d %s\n",
- lastused[i],
+ MEMDEBUG THRprintf(GDKstdout, "#BBPTRIM: %8d%c %7d
%s\n",
+ BBPLASTUSED(lastused[i]),
+ lastused[i] & 0x80000000 ? '*' : ' ',
(int) bbptrim[i].bid,
BBPname(bbptrim[i].bid));
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -238,7 +238,8 @@ HEAPmargin(size_t maxsize)
{
size_t ret;
#if SIZEOF_VOID_P == 8
- /* in 64-bits systems, try to enforce in-place realloc, but provoke the
memcpy on 256MB, then 4GB */
+ /* in 64-bits systems, try to enforce in-place realloc, but
+ * provoke the memcpy on 256MB, then 4GB */
size_t use = GDKvm_cursize();
ret = MIN(GDK_mem_maxsize, MAX(((size_t) 1) << 26, 16 * maxsize));
if ((ret + ret) > (GDK_vm_maxsize - MIN(GDK_vm_maxsize, use))) /* only
if room */
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -311,6 +311,7 @@ int GDK_vm_trim = 1;
#define SEG_SIZE(x,y)
((x)+(((x)&((1<<(y))-1))?(1<<(y))-((x)&((1<<(y))-1)):0))
#define MAX_BIT ((int) (sizeof(ssize_t)<<3))
+#if defined(GDK_MEM_KEEPHISTO) || defined(GDK_VM_KEEPHISTO)
/* histogram update macro */
#define GDKmallidx(idx, size) \
do { \
@@ -328,6 +329,7 @@ int GDK_vm_trim = 1;
_mask >>=1; \
} \
} while (0)
+#endif
static volatile size_t GDK_mallocedbytes_estimate = 0;
static ssize_t GDK_mem_cursize = 0;
@@ -526,7 +528,7 @@ GDKmem_heapinuse(void)
static volatile int GDK_heapcheck_last = 0;
-static inline void
+static void
GDKmem_heapcheck(int t)
{
/* correct heap estimate with the real thing */
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list