11#if ALIB_STRINGS && ALIB_DEBUG && !DOXYGEN
15template<
typename TAllocator>
19 ma.GetStatistics(stats);
24 nf.FractionalPartWidth=2;
25 result <<
"MonoAllocator Usage Statistics:" <<
NNEW_LINE;
27 result <<
" Allocation Size: " <<
NDec( stats.AllocSize , &nf ) <<
NNEW_LINE;
28 result <<
" Current buffer free: " <<
NDec( stats.CurrentBufferFree , &nf ) <<
NNEW_LINE;
29 result <<
" Current buffer used: " <<
NDec( ma.DbgGetBuffer()->act
30 -
reinterpret_cast<char*
>(ma.DbgGetBuffer()) , &nf ) <<
NNEW_LINE;
31 result <<
" Current buffer size: " <<
NDec( stats.CurrentBufferSize , &nf ) <<
NNEW_LINE;
32 result <<
" Next buffer size: " <<
NDec( stats.NextBufferSize , &nf ) <<
NNEW_LINE;
33 result <<
" Buffers in use: " <<
NDec( stats.QtyBuffers , &nf ) <<
NNEW_LINE;
34 result <<
" Buffers allocated: " <<
NDec( stats.QtyBuffers + stats.QtyRecyclables , &nf ) <<
NNEW_LINE;
35 result <<
" Heap size in use: " <<
NDec( stats.HeapSize , &nf ) <<
NNEW_LINE;
36 result <<
" Heap size allocated: " <<
NDec( stats.HeapSize + stats.HeapSizeRecycled , &nf ) <<
NNEW_LINE;
37 result <<
" Unused buffer bytes: " <<
NDec( stats.BufferWaste , &nf );
38 if( stats.QtyBuffers ) result <<
" (per buffer: " <<
NDec( stats.QtyBuffers > 1 ? (stats.BufferWaste / (stats.QtyBuffers-1)) : 0, &nf ) <<
')';
43 result <<
" Dbg: Allocations: " <<
NDec( dbgStats.QtyAllocations , &nf ) <<
NNEW_LINE;
44 result <<
" Dbg: Non-trivial: " <<
NDec( dbgStats.QtyAllocations- dbgStats.QtyTrivialAllocations, &nf ) <<
NNEW_LINE;
45 result <<
" Dbg: Resets: " <<
NDec( dbgStats.QtyResets , &nf ) <<
NNEW_LINE;
47 result <<
" Dbg: #Allocs/buffer: ";
48 if( stats.QtyBuffers == 0 ) { result <<
"N/A";
ALIB_ASSERT( dbgStats.QtyAllocations == 0,
"MONOMEM") }
49 else result <<
NDec( (dbgStats.QtyAllocations / stats.QtyBuffers ), &nf );
52 result <<
" Dbg: Alignm. waste: " <<
NDec( dbgStats.AlignmentWaste , &nf )
53 <<
" (" <<
NDec(
double(dbgStats.AlignmentWaste)/
double(stats.AllocSize) *100. , &nf ) <<
"%)"<<
NNEW_LINE;
54 result <<
" Dbg: Qty exceeds: " <<
NDec( dbgStats.QtyBufferSizeExceeds , &nf ) <<
NNEW_LINE;
#define ALIB_ASSERT(cond, domain)
NAString DbgDumpStatistics(monomem::TMonoAllocator< TAllocator > &ma)
strings::TNumberFormat< nchar > NNumberFormat
Type alias in namespace alib.
strings::NumberFormatFlags NumberFormatFlags
Type alias in namespace alib.
strings::TDec< nchar > NDec
Type alias in namespace alib.
strings::TAString< nchar, lang::HeapAllocator > NAString
Type alias in namespace alib.
constexpr NCString NNEW_LINE
A zero-terminated string containing the new-line character sequence.