src/debug.h
branchgamebalance
changeset 9912 1ac8aac92385
parent 9895 7bd07f43b0e3
equal deleted inserted replaced
9911:0b8b245a2391 9912:1ac8aac92385
    95 	#define OTTD_PRINTF64 "I64"
    95 	#define OTTD_PRINTF64 "I64"
    96 #else
    96 #else
    97 	#define OTTD_PRINTF64 "ll"
    97 	#define OTTD_PRINTF64 "ll"
    98 #endif
    98 #endif
    99 
    99 
   100 /* Used for profiling */
   100 /* Used for profiling
       
   101  *
       
   102  * Usage:
       
   103  * TIC();
       
   104  *   --Do your code--
       
   105  * TOC("A name", 1);
       
   106  *
       
   107  * When you run the TIC() / TOC() multiple times, you can increase the '1'
       
   108  *  to only display average stats every N values. Some things to know:
       
   109  *
       
   110  * for (int i = 0; i < 5; i++) {
       
   111  *   TIC();
       
   112  *     --Do yuor code--
       
   113  *   TOC("A name", 5);
       
   114  * }
       
   115  *
       
   116  * Is the correct usage for multiple TIC() / TOC() calls.
       
   117  *
       
   118  * TIC() / TOC() creates it's own block, so make sure not the mangle
       
   119  *  it with an other block.
       
   120  **/
   101 #define TIC() {\
   121 #define TIC() {\
   102 	extern uint64 _rdtsc();\
   122 	extern uint64 _rdtsc();\
   103 	uint64 _xxx_ = _rdtsc();\
   123 	uint64 _xxx_ = _rdtsc();\
   104 	static uint64 __sum__ = 0;\
   124 	static uint64 __sum__ = 0;\
   105 	static uint32 __i__ = 0;
   125 	static uint32 __i__ = 0;