OpenTTD Source
1.11.0-beta2
|
Go to the documentation of this file.
35 #define DEBUG(name, level, ...) if ((level) == 0 || _debug_ ## name ## _level >= (level)) debug(#name, __VA_ARGS__)
37 extern int _debug_driver_level;
38 extern int _debug_grf_level;
39 extern int _debug_map_level;
40 extern int _debug_misc_level;
41 extern int _debug_net_level;
42 extern int _debug_sprite_level;
43 extern int _debug_oldloader_level;
44 extern int _debug_npf_level;
45 extern int _debug_yapf_level;
46 extern int _debug_freetype_level;
47 extern int _debug_script_level;
48 extern int _debug_sl_level;
49 extern int _debug_gamelog_level;
50 extern int _debug_desync_level;
51 extern int _debug_console_level;
53 extern int _debug_random_level;
56 void CDECL
debug(
const char *dbg,
const char *format, ...) WARN_FORMAT(2, 3);
63 #define FILE_LINE __FILE__, __LINE__
90 uint64 _xxx_ = ottd_rdtsc();\
91 static uint64 _sum_ = 0;\
92 static uint32 _i_ = 0;
94 #define TOC(str, count)\
95 _sum_ += ottd_rdtsc() - _xxx_;\
96 if (++_i_ == count) {\
97 DEBUG(misc, 0, "[%s] " OTTD_PRINTF64 " [avg: %.1f]", str, _sum_, _sum_/(double)_i_);\
105 auto _start_ = std::chrono::high_resolution_clock::now();\
106 static uint64 _sum_ = 0;\
107 static uint32 _i_ = 0;
109 #define TOCC(str, _count_)\
110 _sum_ += (std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - _start_)).count();\
111 if (++_i_ == _count_) {\
112 DEBUG(misc, 0, "[%s] " OTTD_PRINTF64 " us [avg: %.1f us]", str, _sum_, _sum_/(double)_i_);\
119 void ShowInfo(
const char *str);
120 void CDECL
ShowInfoF(
const char *str, ...) WARN_FORMAT(1, 2);
void CDECL debug(const char *dbg, const char *format,...)
Output a debug line.
void CDECL const char * GetLogPrefix()
Get the prefix for logs; if show_date_in_logs is enabled it returns the date, otherwise it returns no...
void CDECL ShowInfoF(const char *str,...)
Shows some information on the console/a popup box depending on the OS.
void SetDebugString(const char *s)
Set debugging levels by parsing the text in s.
void CDECL char * DumpDebugFacilityNames(char *buf, char *last)
Dump the available debug facility names in the help text.
const char * GetDebugString()
Print out the current debug-level.