#include <tMemManager.h>
Static Public Member Functions | |
static void | Check () |
static void | Profile () |
Definition at line 53 of file tMemManager.h.
void tMemManBase::Check | ( | ) | [static] |
Definition at line 1174 of file tMemManager.cpp.
Referenced by tMemMan::Alloc(), and gGame::Timestep().
01177 { 01178 if (!inited) 01179 return; 01180 01181 #ifdef WIN32 01182 EnterCriticalSection(&mutex); 01183 #endif 01184 01185 for (int i=MAX_SIZE;i>=0;i--) 01186 memman[i].Check(); 01187 01188 #ifdef WIN32
void tMemManBase::Profile | ( | ) | [static] |
Definition at line 1421 of file tMemManager.cpp.
References cs.
Referenced by leak(), and tMemManager::~tMemManager().
01424 { 01425 tBottleNeck neck; 01426 #ifdef PROFILER 01427 01428 int sort_checksum[MAXCHECKSUM]; 01429 int size=0,i; 01430 01431 for (i=MAXCHECKSUM-1;i>=0;i--) 01432 if (checksum_blocks[i]) 01433 sort_checksum[size++] = i; 01434 01435 qsort(sort_checksum, size, sizeof(int), &compare); 01436 01437 static int num=1; 01438 01439 char name[100]; 01440 snprintf( name, 99, "memprofile%d.txt", num++ ); 01441 // std::ostringstream fn; 01442 01443 // fn << "memprofile" << num++ << ".txt" << '\0'; 01444 01445 01446 FILE *f = fopen( name, "w" ); 01447 // fprintf( f, "%d\t%d\t%d\t%s\t%s\t%d\t%d\t\n", ) 01448 01449 int total_blocks=0,total_bytes =0; 01450 01451 for (i=size-1; i>=0; i--) 01452 { 01453 int cs = sort_checksum[i]; 01454 const char *fn = checksum_filename[cs]; 01455 const char *cn = checksum_classname[cs]; 01456 01457 if (!fn) 01458 fn = "XXX"; 01459 if (!cn) 01460 cn = "XXX"; 01461 01462 fprintf( f, "%d\t%d\t%30s\t%80s\t%d\t%d\t\n", checksum_blocks[cs], checksum_bytes[cs],cn, fn , checksum_line[cs], cs ); 01463 // PRINT(checksum_blocks[cs], checksum_bytes[cs],cn, fn , checksum_line[cs], cs); 01464 total_blocks += checksum_blocks[cs]; 01465 total_bytes += checksum_bytes[cs]; 01466 } 01467 01468 fclose( f ); 01469 01470 01471 /* 01472 std::ofstream s( name ); 01473 s.setf(std::ios::left); 01474 01475 PRINT("Blocks", "Bytes", "Class", "File", "Line", "Checksum"); 01476 01477 int total_blocks=0,total_bytes =0; 01478 01479 for (i=size-1; i>=0; i--) 01480 { 01481 int cs = sort_checksum[i]; 01482 const char *fn = checksum_fileName[cs]; 01483 const char *cn = checksum_classname[cs]; 01484 01485 if (!fn) 01486 fn = "XXX"; 01487 if (!cn) 01488 cn = "XXX"; 01489 01490 PRINT(checksum_blocks[cs], checksum_bytes[cs],cn, fn , checksum_line[cs], cs); 01491 total_blocks += checksum_blocks[cs]; 01492 total_bytes += checksum_bytes[cs]; 01493 } 01494 01495 s << "\n\n"; 01496 PRINT (total_blocks, total_bytes, "Total" , "", "", "");