diff options
Diffstat (limited to 'storage/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp')
-rw-r--r-- | storage/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp index 1182ac4ee7d..8e532ae97b5 100644 --- a/storage/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp +++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp @@ -74,6 +74,10 @@ Dbtup::reportMemoryUsage(Signal* signal, int incDec){ sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 6, JBB); } +#ifdef VM_TRACE +extern Uint32 fc_left, fc_right, fc_remove; +#endif + void Dbtup::execDUMP_STATE_ORD(Signal* signal) { @@ -155,12 +159,20 @@ Dbtup::execDUMP_STATE_ORD(Signal* signal) return; }//if #endif -#if defined VM_TRACE && 0 - if (type == 1211){ - ndbout_c("Startar modul test av Page Manager"); +#if defined VM_TRACE + if (type == 1211 || type == 1212 || type == 1213){ + Uint32 seed = time(0); + if (signal->getLength() > 1) + seed = signal->theData[1]; + ndbout_c("Startar modul test av Page Manager (seed: 0x%x)", seed); + srand(seed); Vector<Chunk> chunks; const Uint32 LOOPS = 1000; + Uint32 sum_req = 0; + Uint32 sum_conf = 0; + Uint32 sum_loop = 0; + Uint32 max_loop = 0; for(Uint32 i = 0; i<LOOPS; i++){ // Case @@ -177,8 +189,15 @@ Dbtup::execDUMP_STATE_ORD(Signal* signal) if(chunks.size() == 0 && c == 0){ c = 1 + rand() % 2; } + + if (type == 1211) + ndbout_c("loop=%d case=%d free=%d alloc=%d", i, c, free, alloc); - ndbout_c("loop=%d case=%d free=%d alloc=%d", i, c, free, alloc); + if (type == 1213) + { + c = 1; + alloc = 2 + (sum_conf >> 3) + (sum_conf >> 4); + } switch(c){ case 0:{ // Release const int ch = rand() % chunks.size(); @@ -190,23 +209,33 @@ Dbtup::execDUMP_STATE_ORD(Signal* signal) case 2: { // Seize(n) - fail alloc += free; // Fall through + sum_req += free; + goto doalloc; } case 1: { // Seize(n) (success) - + sum_req += alloc; + doalloc: Chunk chunk; allocConsPages(alloc, chunk.pageCount, chunk.pageId); ndbrequire(chunk.pageCount <= alloc); if(chunk.pageCount != 0){ chunks.push_back(chunk); if(chunk.pageCount != alloc) { - ndbout_c(" Tried to allocate %d - only allocated %d - free: %d", - alloc, chunk.pageCount, free); + if (type == 1211) + ndbout_c(" Tried to allocate %d - only allocated %d - free: %d", + alloc, chunk.pageCount, free); } } else { ndbout_c(" Failed to alloc %d pages with %d pages free", alloc, free); } + sum_conf += chunk.pageCount; + Uint32 tot = fc_left + fc_right + fc_remove; + sum_loop += tot; + if (tot > max_loop) + max_loop = tot; + for(Uint32 i = 0; i<chunk.pageCount; i++){ PagePtr pagePtr; pagePtr.i = chunk.pageId + i; @@ -225,6 +254,10 @@ Dbtup::execDUMP_STATE_ORD(Signal* signal) returnCommonArea(chunk.pageId, chunk.pageCount); chunks.erase(chunks.size() - 1); } + + ndbout_c("Got %u%% of requested allocs, loops : %u 100*avg: %u max: %u", + (100 * sum_conf) / sum_req, sum_loop, 100*sum_loop / LOOPS, + max_loop); } #endif }//Dbtup::execDUMP_STATE_ORD() |