MCPcopy Create free account
hub / github.com/doldecomp/mkdd / dump_sort

Method dump_sort

libs/JSystem/JKernel/JKRExpHeap.cpp:903–963  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

901}
902
903bool JKRExpHeap::dump_sort()
904{
905 lock();
906 bool result = check();
907 u32 usedBytes = 0;
908 u32 usedCount = 0;
909 u32 freeCount = 0;
910 JUTReportConsole(" attr address: size gid aln prev_ptr next_ptr\n");
911 JUTReportConsole("(Used Blocks)\n");
912 if (mHeadUsedList == nullptr)
913 {
914 JUTReportConsole(" NONE\n");
915 }
916 else
917 {
918 CMemBlock *var1 = nullptr;
919 while (true)
920 {
921 CMemBlock *block = (CMemBlock *)0xffffffff;
922 for (CMemBlock *iterBlock = mHeadUsedList; iterBlock; iterBlock = iterBlock->mNext)
923 {
924 if (var1 < iterBlock && iterBlock < block)
925 {
926 block = iterBlock;
927 }
928 }
929 if (block == (CMemBlock *)0xffffffff)
930 {
931 break;
932 }
933 if (!block->isValid())
934 {
935 JUTReportConsole_f("xxxxx %08x: -------- --- --- (-------- --------)\nabort\n");
936 break;
937 }
938 int offset = block->getAlignment();
939 void *content = block->getContent();
940 const char *type = block->_isTempMemBlock() ? " temp" : "alloc";
941 JUTReportConsole_f("%s %08x: %08x %3d %3d (%08x %08x)\n", type, content, block->mAllocatedSpace, block->mGroupID, offset,
942 block->mPrev, block->mNext);
943 usedBytes += sizeof(CMemBlock) + block->mAllocatedSpace + block->getAlignment();
944 usedCount++;
945 var1 = block;
946 }
947 }
948 JUTReportConsole("(Free Blocks)\n");
949 if (mHead == nullptr)
950 {
951 JUTReportConsole(" NONE\n");
952 }
953 for (CMemBlock *block = mHead; block; block = block->mNext)
954 {
955 JUTReportConsole_f("%s %08x: %08x %3d %3d (%08x %08x)\n", " free", block->getContent(), block->mAllocatedSpace, block->mGroupID,
956 block->getAlignment(), block->mPrev, block->mNext);
957 freeCount++;
958 }
959 float percent = ((float)usedBytes / (float)mHeapSize) * 100.0f;
960 JUTReportConsole_f("%d / %d bytes (%6.2f%%) used (U:%d F:%d)\n", usedBytes, mHeapSize, percent, usedCount, freeCount);

Callers

nothing calls this directly

Calls 9

lockFunction · 0.85
checkFunction · 0.85
JUTReportConsoleFunction · 0.85
JUTReportConsole_fFunction · 0.85
unlockFunction · 0.85
getAlignmentMethod · 0.80
getContentMethod · 0.80
_isTempMemBlockMethod · 0.80
isValidMethod · 0.45

Tested by

no test coverage detected