Provides Report on memory usage by the application. Please note, the HTML generated by this function is partial and comprises only the table of interest. Returns: None
| Return Type | Function name | Arguments |
|---|---|---|
| void | ReportMemoryUsage | (hzChain&,bool,) |
Declared in file: hzProcess.h
Defined in file : hzMemory.cpp
Function Logic:
Function body:
void ReportMemoryUsage (hzChain& Z)bool bHtml,
{
// Category: Diagnostics
//
// Provides Report on memory usage by the application.
//
// Please note, the HTML generated by this function is partial and comprises only the table of interest.
//
// Argument: Z The hzChain instance to receive the report
// Returns: None
static hzMeminfo pms = _hzGlobal_Memstats ; // Previous/initial memory statistics
hzMeminfo cms ; // Current memory stats
hzXDate now ; // Current date and time
uint32_t total = 0; // Total memory usage
now.SysDateTime() ;
// Take current snapshot
cms = _hzGlobal_Memstats ;
if (bHtml)
Z.Printf("<p><center>Memory Report at %s</center></p>\n", *now) ;
else
Z.Printf("Memory Report at %s\n", *now) ;
g_pSMAR_Str->Report(Z) ; // Used exclusively by hzString
g_pSMAR_Inet->Report(Z) ; // Used by hzEmaddr, hzDomain and hzUrl
g_pSMAR_Edo->Report(Z) ; // Used exclusively by hdbObjRepos to store EDOs
// If no heap, this is presented as collections on the LHS and string/chains on the RHS in one 'row'. If there is a heap we have string/chains on the top
// LHS, collections on the bottom LHS and the heap activity on the RHS
if (s_Heap)
{
// Two reports on LHS
if (bHtml)
{
Z <<
"<table width=\"1400\" slign=\"center\">\n<tr>\n <td valign=\"top\">\n <table width=\"750\" slign=\"center\">\n <tr>\n <td>\n"
;
_report_objects(Z, cms, pms, total, bHtml) ;
Z <<
" </td>\n </tr>\n </table>\n </td>\n <td width=\"15\"> </td>\n <td>\n <table width=\"550\" slign=\"center\">\n <tr>\n <td>\n"
;
// Heap on RHS
_report_heap(Z, cms, pms, total, bHtml) ;
Z <<
" </td>\n </tr>\n </table>\n </td>\n</tr>\n</table>\n"
;
}
else
{
_report_objects(Z, cms, pms, total, bHtml) ;
_report_heap(Z, cms, pms, total, bHtml) ;
}
}
else
{
// collection on LHS, string chans on RHS
if (!bHtml)
_report_objects(Z, cms, pms, total, bHtml) ;
else
{
Z <<
"<table width=\"1400\" slign=\"center\">\n<tr>\n <td valign=\"top\">\n"
;
_report_objects(Z, cms, pms, total, bHtml) ;
Z <<
" </td>\n</tr>\n</table>\n"
;
}
}
pms = cms ;
}