MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / logMemInfo

Method logMemInfo

src/runtime/context.cpp:118–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116 }
117
118 void Context::logMemInfo(TextWriter & tw) {
119 uint64_t bytesTotal = 0, bytesUsed = 0;
120 // context
121 tw << "Context: 0x" << HEX << intptr_t(this) << DEC << " '" << name << "' use_count = " << use_count() << "\n";
122 bytesTotal = bytesUsed = sizeof(Context);
123 // stringHeap
124 if ( stringHeap ) {
125 tw << "\tstringHeap: " << stringHeap->bytesAllocated() << " of " << stringHeap->totalAlignedMemoryAllocated()
126 << ", depth = " << stringHeap->depth() << "\n";
127 bytesTotal += stringHeap->totalAlignedMemoryAllocated();
128 bytesUsed += stringHeap->bytesAllocated();
129 }
130 // constStringHeap
131 if ( constStringHeap ) {
132 tw << "\tconstStringHeap: " << constStringHeap->bytesAllocated() << " of " << constStringHeap->totalAlignedMemoryAllocated()
133 << ", depth = " << constStringHeap->depth() << "\n";
134 bytesTotal += constStringHeap->totalAlignedMemoryAllocated();
135 bytesUsed += constStringHeap->bytesAllocated();
136 }
137 // heap
138 if ( heap ) {
139 tw << "\theap: " << heap->bytesAllocated() << " of " << heap->totalAlignedMemoryAllocated()
140 << ", depth = " << heap->depth() << "\n";
141 bytesTotal += heap->totalAlignedMemoryAllocated();
142 bytesUsed += heap->bytesAllocated();
143 }
144 // code
145 if ( code ) {
146 tw << "\tcode: " << code->bytesAllocated() << " of " << code->totalAlignedMemoryAllocated()
147 << ", depth = " << code->depth() << "\n";
148 tw << "\t\ttableMN[" << tabMnLookup->size() << "]\n";
149 tw << "\t\ttableGMN[" << tabGMnLookup->size() << "]\n";
150 tw << "\t\ttableAd[" << tabAdLookup->size() << "]\n";
151 int aotf = 0;
152 for ( int i=0, is=totalFunctions; i!=is; ++i ) {
153 if ( functions[i].aotFunction ) aotf++;
154 }
155 if ( aotf>0 ) {
156 int64_t saot = int64_t(sizeof(SimNode_CallBase));
157 tw << "\tAOT " << aotf << " of " << totalFunctions << ", " << aotf << " x sizeof(SimNode_Aot = " << saot << ") = " << aotf*saot << "\n";
158 }
159 bytesTotal += code->totalAlignedMemoryAllocated();
160 bytesUsed += code->bytesAllocated();
161 }
162 // debugInfo
163 if ( debugInfo ) {
164 tw << "\tdebugInfo: " << debugInfo->bytesAllocated() << " of " << debugInfo->totalAlignedMemoryAllocated()
165 << ", depth = " << debugInfo->depth() << "\n";
166 bytesTotal += debugInfo->totalAlignedMemoryAllocated();
167 bytesUsed += debugInfo->bytesAllocated();
168 }
169 // stack
170 if ( stack.bottom() ) {
171 tw << "\tstack: " << stack.size() << "\n";
172 bytesTotal += stack.size();
173 bytesUsed += stack.size();
174 }
175 // functions

Callers

nothing calls this directly

Calls 6

bottomMethod · 0.80
use_countFunction · 0.50
bytesAllocatedMethod · 0.45
depthMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected