void DumpStats( void ) { DWORD dwFree, dwUsed, dwChunks, dwFreeChunks; char msg[256]; GetMemStats(&dwFree, &dwUsed, &dwChunks, &dwFreeChunks); sprintf( msg, WIDE("MemStat: Used: %d(%d) Free: %d(%d)") , dwUsed, dwChunks - dwFreeChunks , dwFree, dwFreeChunks ); ODS( msg ); }
//-------------------------------------- int CPROC MEMORY( PSENTIENT ps, PTEXT parameters ) { uint32_t nFree, nUsed, nChunks, nFreeChunks; PVARTEXT vt; PTEXT temp, next; next = GetParam( ps, ¶meters ); while( temp = next ) { if( temp && TextLike( temp, WIDE("log") ) ) { temp = GetParam( ps, ¶meters ); if( temp && TextLike( temp, WIDE("off") ) ) SetAllocateLogging( FALSE ); else { SetAllocateLogging( TRUE ); if( temp ) { next = temp; continue; } } } if( temp && TextLike( temp, WIDE("debug") ) ) { temp = GetParam( ps, ¶meters ); if( temp && TextLike( temp, WIDE("off") ) ) SetAllocateDebug( TRUE ); else { SetAllocateDebug( FALSE ); if( temp ) { next = temp; continue; } } } next = GetParam( ps, ¶meters ); } GetMemStats( &nFree, &nUsed, &nChunks, &nFreeChunks ); vt = VarTextCreate( ); vtprintf( vt, WIDE("Memory : Free %ld(%ld), Used %ld(%ld) (optional paramters \'log\',\'debug\' followed by off to disable."), nFree, nFreeChunks, nUsed, nChunks - nFreeChunks ); EnqueLink( &ps->Command->Output, VarTextGet( vt ) ); VarTextDestroy( &vt ); return FALSE; }
int main( void ) { void *info = NULL; uint32_t free, used, chuncks, freechunks; SetSystemLog( SYSLOG_FILE, stdout ); printf( WIDE("Lets see... ini files...") ); while( ScanFiles( WIDE("."), WIDE("*.ini"), &info, ParseINI, 0, 0 ) ); GetMemStats( &free, &used, &chuncks, &freechunks ); printf( WIDE("Memory result : free:%ld used:%ld chuncks:%ld freechunks:%ld\n") , free, used, chuncks, freechunks ); DumpRegisteredNames(); SaveTree(); LoadTree(); DumpRegisteredNames(); return 0; }
int main( void ) { CDATA result; result = Color(127,127,127); while( PickColorEx( &result, result, 0, 256, 150 ) ) { printf( WIDE("Guess what! We got a color: %08") _32fX WIDE("\n"), result ); { uint32_t free,used,chunks,freechunks; Sleep( 1000 );// wait a moment for the dialog to really go away. GetMemStats( &free, &used, &chunks, &freechunks ); printf( WIDE("Debug: used:%") _32f WIDE(" free:%") _32f WIDE(" chunks:%") _32f WIDE(" freechunks:%") _32f WIDE("\n") , used,free,chunks,freechunks ); DebugDumpMem(); } } printf( WIDE("Color Dialog was canceled.\n") ); return 0; }