OpenTTD Source
12.0-beta2
|
Go to the documentation of this file.
15 #include "3rdparty/fmt/format.h"
37 #define Debug(name, level, format_string, ...) if ((level) == 0 || _debug_ ## name ## _level >= (level)) DebugPrint(#name, fmt::format(FMT_STRING(format_string), ## __VA_ARGS__))
38 void DebugPrint(
const char *level,
const std::string &message);
40 extern int _debug_driver_level;
41 extern int _debug_grf_level;
42 extern int _debug_map_level;
43 extern int _debug_misc_level;
44 extern int _debug_net_level;
45 extern int _debug_sprite_level;
46 extern int _debug_oldloader_level;
47 extern int _debug_npf_level;
48 extern int _debug_yapf_level;
49 extern int _debug_freetype_level;
50 extern int _debug_script_level;
51 extern int _debug_sl_level;
52 extern int _debug_gamelog_level;
53 extern int _debug_desync_level;
54 extern int _debug_console_level;
56 extern int _debug_random_level;
64 #define FILE_LINE __FILE__, __LINE__
91 uint64 _xxx_ = ottd_rdtsc();\
92 static uint64 _sum_ = 0;\
93 static uint32 _i_ = 0;
95 #define TOC(str, count)\
96 _sum_ += ottd_rdtsc() - _xxx_;\
97 if (++_i_ == count) {\
98 Debug(misc, 0, "[{}] {} [avg: {:.1f}]", str, _sum_, _sum_/(double)_i_);\
106 auto _start_ = std::chrono::high_resolution_clock::now();\
107 static uint64 _sum_ = 0;\
108 static uint32 _i_ = 0;
110 #define TOCC(str, _count_)\
111 _sum_ += (std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - _start_)).count();\
112 if (++_i_ == _count_) {\
113 Debug(misc, 0, "[{}] {} us [avg: {:.1f} us]", str, _sum_, _sum_/(double)_i_);\
120 void ShowInfo(
const char *str);
121 void CDECL
ShowInfoF(
const char *str, ...) WARN_FORMAT(1, 2);
void DebugPrint(const char *level, const std::string &message)
Internal function for outputting the 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...
char * DumpDebugFacilityNames(char *buf, char *last)
Dump the available debug facility names in the help text.
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.
const char * GetDebugString()
Print out the current debug-level.