Lines Matching refs:mem5
16318 } mem5; variable
16323 #define mem5 GLOBAL(struct Mem5Global, mem5) macro
16329 #define MEM5LINK(idx) ((Mem5Link *)(&mem5.zPool[(idx)*mem5.szAtom]))
16337 assert( i>=0 && i<mem5.nBlock ); in memsys5Unlink()
16339 assert( (mem5.aCtrl[i] & CTRL_LOGSIZE)==iLogsize ); in memsys5Unlink()
16344 mem5.aiFreelist[iLogsize] = next; in memsys5Unlink()
16359 assert( sqlite3_mutex_held(mem5.mutex) ); in memsys5Link()
16360 assert( i>=0 && i<mem5.nBlock ); in memsys5Link()
16362 assert( (mem5.aCtrl[i] & CTRL_LOGSIZE)==iLogsize ); in memsys5Link()
16364 x = MEM5LINK(i)->next = mem5.aiFreelist[iLogsize]; in memsys5Link()
16367 assert( x<mem5.nBlock ); in memsys5Link()
16370 mem5.aiFreelist[iLogsize] = i; in memsys5Link()
16379 sqlite3_mutex_enter(mem5.mutex); in memsys5Enter()
16382 sqlite3_mutex_leave(mem5.mutex); in memsys5Leave()
16393 int i = ((u8 *)p-mem5.zPool)/mem5.szAtom; in memsys5Size()
16394 assert( i>=0 && i<mem5.nBlock ); in memsys5Size()
16395 iSize = mem5.szAtom * (1 << (mem5.aCtrl[i]&CTRL_LOGSIZE)); in memsys5Size()
16409 i = iFirst = mem5.aiFreelist[iLogsize]; in memsys5UnlinkFirst()
16440 if( (u32)nByte>mem5.maxRequest ){ in memsys5MallocUnsafe()
16441 mem5.maxRequest = nByte; in memsys5MallocUnsafe()
16452 for(iFullSz=mem5.szAtom, iLogsize=0; iFullSz<nByte; iFullSz *= 2, iLogsize++){} in memsys5MallocUnsafe()
16458 for(iBin=iLogsize; mem5.aiFreelist[iBin]<0 && iBin<=LOGMAX; iBin++){} in memsys5MallocUnsafe()
16470 mem5.aCtrl[i+newSize] = CTRL_FREE | iBin; in memsys5MallocUnsafe()
16473 mem5.aCtrl[i] = iLogsize; in memsys5MallocUnsafe()
16476 mem5.nAlloc++; in memsys5MallocUnsafe()
16477 mem5.totalAlloc += iFullSz; in memsys5MallocUnsafe()
16478 mem5.totalExcess += iFullSz - nByte; in memsys5MallocUnsafe()
16479 mem5.currentCount++; in memsys5MallocUnsafe()
16480 mem5.currentOut += iFullSz; in memsys5MallocUnsafe()
16481 if( mem5.maxCount<mem5.currentCount ) mem5.maxCount = mem5.currentCount; in memsys5MallocUnsafe()
16482 if( mem5.maxOut<mem5.currentOut ) mem5.maxOut = mem5.currentOut; in memsys5MallocUnsafe()
16485 return (void*)&mem5.zPool[i*mem5.szAtom]; in memsys5MallocUnsafe()
16498 iBlock = ((u8 *)pOld-mem5.zPool)/mem5.szAtom; in memsys5FreeUnsafe()
16501 assert( iBlock>=0 && iBlock<mem5.nBlock ); in memsys5FreeUnsafe()
16502 assert( ((u8 *)pOld-mem5.zPool)%mem5.szAtom==0 ); in memsys5FreeUnsafe()
16503 assert( (mem5.aCtrl[iBlock] & CTRL_FREE)==0 ); in memsys5FreeUnsafe()
16505 iLogsize = mem5.aCtrl[iBlock] & CTRL_LOGSIZE; in memsys5FreeUnsafe()
16507 assert( iBlock+size-1<(u32)mem5.nBlock ); in memsys5FreeUnsafe()
16509 mem5.aCtrl[iBlock] |= CTRL_FREE; in memsys5FreeUnsafe()
16510 mem5.aCtrl[iBlock+size-1] |= CTRL_FREE; in memsys5FreeUnsafe()
16511 assert( mem5.currentCount>0 ); in memsys5FreeUnsafe()
16512 assert( mem5.currentOut>=(size*mem5.szAtom) ); in memsys5FreeUnsafe()
16513 mem5.currentCount--; in memsys5FreeUnsafe()
16514 mem5.currentOut -= size*mem5.szAtom; in memsys5FreeUnsafe()
16515 assert( mem5.currentOut>0 || mem5.currentCount==0 ); in memsys5FreeUnsafe()
16516 assert( mem5.currentCount>0 || mem5.currentOut==0 ); in memsys5FreeUnsafe()
16518 mem5.aCtrl[iBlock] = CTRL_FREE | iLogsize; in memsys5FreeUnsafe()
16527 if( (iBuddy+(1<<iLogsize))>mem5.nBlock ) break; in memsys5FreeUnsafe()
16528 if( mem5.aCtrl[iBuddy]!=(CTRL_FREE | iLogsize) ) break; in memsys5FreeUnsafe()
16532 mem5.aCtrl[iBuddy] = CTRL_FREE | iLogsize; in memsys5FreeUnsafe()
16533 mem5.aCtrl[iBlock] = 0; in memsys5FreeUnsafe()
16536 mem5.aCtrl[iBlock] = CTRL_FREE | iLogsize; in memsys5FreeUnsafe()
16537 mem5.aCtrl[iBuddy] = 0; in memsys5FreeUnsafe()
16617 for(iFullSz=mem5.szAtom; iFullSz<n; iFullSz *= 2); in memsys5Roundup()
16653 mem5.mutex = 0; in memsys5Init()
16666 mem5.szAtom = (1<<nMinLog); in memsys5Init()
16667 while( (int)sizeof(Mem5Link)>mem5.szAtom ){ in memsys5Init()
16668 mem5.szAtom = mem5.szAtom << 1; in memsys5Init()
16671 mem5.nBlock = (nByte / (mem5.szAtom+sizeof(u8))); in memsys5Init()
16672 mem5.zPool = zByte; in memsys5Init()
16673 mem5.aCtrl = (u8 *)&mem5.zPool[mem5.nBlock*mem5.szAtom]; in memsys5Init()
16676 mem5.aiFreelist[ii] = -1; in memsys5Init()
16682 if( (iOffset+nAlloc)<=mem5.nBlock ){ in memsys5Init()
16683 mem5.aCtrl[iOffset] = ii | CTRL_FREE; in memsys5Init()
16687 assert((iOffset+nAlloc)>mem5.nBlock); in memsys5Init()
16692 mem5.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); in memsys5Init()
16703 mem5.mutex = 0; in memsys5Shutdown()
16728 nMinLog = memsys5Log(mem5.szAtom); in sqlite3Memsys5Dump()
16730 for(n=0, j=mem5.aiFreelist[i]; j>=0; j = MEM5LINK(j)->next, n++){} in sqlite3Memsys5Dump()
16731 fprintf(out, "freelist items of size %d: %d\n", mem5.szAtom << i, n); in sqlite3Memsys5Dump()
16733 fprintf(out, "mem5.nAlloc = %llu\n", mem5.nAlloc); in sqlite3Memsys5Dump()
16734 fprintf(out, "mem5.totalAlloc = %llu\n", mem5.totalAlloc); in sqlite3Memsys5Dump()
16735 fprintf(out, "mem5.totalExcess = %llu\n", mem5.totalExcess); in sqlite3Memsys5Dump()
16736 fprintf(out, "mem5.currentOut = %u\n", mem5.currentOut); in sqlite3Memsys5Dump()
16737 fprintf(out, "mem5.currentCount = %u\n", mem5.currentCount); in sqlite3Memsys5Dump()
16738 fprintf(out, "mem5.maxOut = %u\n", mem5.maxOut); in sqlite3Memsys5Dump()
16739 fprintf(out, "mem5.maxCount = %u\n", mem5.maxCount); in sqlite3Memsys5Dump()
16740 fprintf(out, "mem5.maxRequest = %u\n", mem5.maxRequest); in sqlite3Memsys5Dump()