Changeset: 7debe56782d5 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7debe56782d5
Modified Files:
        monetdb5/mal/mal_profiler.c
        monetdb5/mal/mal_resource.c
        monetdb5/mal/mal_resource.h
        sql/backends/monet5/sql.c
Branch: default
Log Message:

Refine size calculations


diffs (78 lines):

diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -274,13 +274,13 @@ This information can be used to determin
                                        tname = getTypeName(getColumnType(tpe));
                                        logadd("\"type\":\"bat[:%s]\",%s", 
tname,pret);
                                        if( d) {
-                                               if( isVIEW(d))
-                                                       bid = 
abs(VIEWtparent(d));
+                                               //if( isVIEW(d))
+                                                       //bid = 
abs(VIEWtparent(d));
                                                cnt = BATcount(d);
-                                               total += heapinfo(&d->T->heap);
-                                               if ( d->T->vheap && 
d->T->vheap->parentid ){
-                                                       total += 
heapinfo(d->T->vheap); 
-                                               }
+                                               total += cnt * d->T->width;
+                                               total += heapinfo(d->T->vheap, 
abs(d->batCacheid)); 
+                                               total += hashinfo(d->T->hash, 
abs(d->batCacheid)); 
+                                               total += IMPSimprintsize(d);
                                                BBPunfix(d->batCacheid);
                                        } 
                                        logadd("\"bid\":\"%d\",%s", bid,pret);
diff --git a/monetdb5/mal/mal_resource.c b/monetdb5/mal/mal_resource.c
--- a/monetdb5/mal/mal_resource.c
+++ b/monetdb5/mal/mal_resource.c
@@ -76,12 +76,11 @@ getMemoryClaim(MalBlkPtr mb, MalStkPtr s
                        return 0;
                }
 
-               total += heapinfo(&b->T->heap); 
+               total += BATcount(b) * b->T->width;
                // string heaps can be shared, consider them as space-less views
-               if ( b->T->vheap && b->T->vheap->parentid ){
-                       total += heapinfo(b->T->vheap); 
-               }
-               //total += hashinfo(b->T->hash); 
+               total += heapinfo(b->T->vheap, abs(b->batCacheid)); 
+               total += hashinfo(b->T->hash, abs(d->batCacheid)); 
+               total += IMPSimprintsize(b);
                //total = total > (lng)(MEMORY_THRESHOLD ) ? 
(lng)(MEMORY_THRESHOLD ) : total;
                BBPunfix(b->batCacheid);
        }
diff --git a/monetdb5/mal/mal_resource.h b/monetdb5/mal/mal_resource.h
--- a/monetdb5/mal/mal_resource.h
+++ b/monetdb5/mal/mal_resource.h
@@ -15,8 +15,9 @@
 #define DELAYUNIT 2 /* ms delay in parallel processing decisions */
 #define MAX_DELAYS 1000 /* never wait forever */
 
-#define heapinfo(X) ((X) && (X)->base ? (X)->free: 0)
-#define hashinfo(X) ( (X)? heapinfo((X)->heap):0)
+//#define heapinfo(X,Id)       (((X) && (X)->base && ((X)->parentid == 0 || 
(X)->parentid == Id)) ? (X)->free : 0)
+#define heapinfo(X,Id) (((X) && (X)->base ) ? (X)->free : 0)
+#define hashinfo(X,Id) ( (X)? heapinfo((X)->heap, Id):0)
 
 #define USE_MAL_ADMISSION
 #ifdef USE_MAL_ADMISSION
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -4865,13 +4865,13 @@ sql_storage(Client cntxt, MalBlkPtr mb, 
                                                                }
                                                                BUNappend(atom, 
&w, FALSE);
 
-                                                               sz = 
heapinfo(&bn->T->heap);
+                                                               sz = 
BATcount(bn) * bn->T->width; 
                                                                BUNappend(size, 
&sz, FALSE);
 
-                                                               sz = 
heapinfo(bn->T->vheap);
+                                                               sz = 
heapinfo(bn->T->vheap, abs(bn->batCacheid));
                                                                BUNappend(heap, 
&sz, FALSE);
 
-                                                               sz = 
hashinfo(bn->T->hash);
+                                                               sz = 
hashinfo(bn->T->hash, abs(bn->batCacheid));
                                                                
BUNappend(indices, &sz, FALSE);
 
                                                                bitval = 0; /* 
HASHispersistent(bn); */
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to