#include "cpu.h"
#include <chrono>
Go to the source code of this file.
|
#define | DEBUG(name, level, ...) if ((level) == 0 || _debug_ ## name ## _level >= (level)) debug(#name, __VA_ARGS__) |
| Output a line of debugging information. More...
|
|
#define | FILE_LINE __FILE__, __LINE__ |
|
#define | TIC() |
|
#define | TOC(str, count) |
|
#define | TICC() |
|
#define | TOCC(str, _count_) |
|
|
void CDECL | debug (const char *dbg, const char *format,...) WARN_FORMAT(2 |
|
void CDECL char * | DumpDebugFacilityNames (char *buf, char *last) |
| Dump the available debug facility names in the help text. More...
|
|
void | SetDebugString (const char *s) |
| Set debugging levels by parsing the text in s. More...
|
|
const char * | GetDebugString () |
| Print out the current debug-level. More...
|
|
void | ShowInfo (const char *str) |
|
void CDECL | ShowInfoF (const char *str,...) WARN_FORMAT(1 |
|
void CDECL const char * | GetLogPrefix () |
| Get the prefix for logs; if show_date_in_logs is enabled it returns the date, otherwise it returns nothing. More...
|
|
|
int | _debug_driver_level |
|
int | _debug_grf_level |
|
int | _debug_map_level |
|
int | _debug_misc_level |
|
int | _debug_net_level |
|
int | _debug_sprite_level |
|
int | _debug_oldloader_level |
|
int | _debug_npf_level |
|
int | _debug_yapf_level |
|
int | _debug_freetype_level |
|
int | _debug_script_level |
|
int | _debug_sl_level |
|
int | _debug_gamelog_level |
|
int | _debug_desync_level |
|
int | _debug_console_level |
|
Functions related to debugging.
Definition in file debug.h.
◆ DEBUG
#define DEBUG |
( |
|
name, |
|
|
|
level, |
|
|
|
... |
|
) |
| if ((level) == 0 || _debug_ ## name ## _level >= (level)) debug(#name, __VA_ARGS__) |
Output a line of debugging information.
- Parameters
-
name | Category |
level | Debugging level, higher levels means more detailed information. |
Definition at line 35 of file debug.h.
◆ TIC
Value: {\
static uint64 _sum_ = 0;\
static uint32 _i_ = 0;
Definition at line 89 of file debug.h.
◆ TICC
Value: {\
auto _start_ = std::chrono::high_resolution_clock::now();\
static uint64 _sum_ = 0;\
static uint32 _i_ = 0;
Definition at line 104 of file debug.h.
◆ TOC
#define TOC |
( |
|
str, |
|
|
|
count |
|
) |
| |
Value:
if (++_i_ == count) {\
DEBUG(misc, 0, "[%s] " OTTD_PRINTF64 " [avg: %.1f]", str, _sum_, _sum_/(double)_i_);\
_i_ = 0;\
_sum_ = 0;\
}\
}
Definition at line 94 of file debug.h.
◆ TOCC
#define TOCC |
( |
|
str, |
|
|
|
_count_ |
|
) |
| |
Value: _sum_ += (std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - _start_)).count();\
if (++_i_ == _count_) {\
DEBUG(misc, 0, "[%s] " OTTD_PRINTF64 " us [avg: %.1f us]", str, _sum_, _sum_/(double)_i_);\
_i_ = 0;\
_sum_ = 0;\
}\
}
Definition at line 109 of file debug.h.
◆ DumpDebugFacilityNames()
void CDECL char* DumpDebugFacilityNames |
( |
char * |
buf, |
|
|
char * |
last |
|
) |
| |
Dump the available debug facility names in the help text.
- Parameters
-
buf | Start address for storing the output. |
last | Last valid address for storing the output. |
- Returns
- Next free position in the output.
Definition at line 82 of file debug.cpp.
◆ GetDebugString()
const char* GetDebugString |
( |
| ) |
|
Print out the current debug-level.
Just return a string with the values of all the debug categories.
- Returns
- string with debug-levels
Definition at line 224 of file debug.cpp.
◆ GetLogPrefix()
void CDECL const char* GetLogPrefix |
( |
| ) |
|
◆ SetDebugString()
void SetDebugString |
( |
const char * |
s | ) |
|
Set debugging levels by parsing the text in s.
For setting individual levels a string like "net=3,grf=6"
should be used. If the string starts with a number, the number is used as global debugging level.
- Parameters
-
s | Text describing the wanted debugging levels. |
Definition at line 170 of file debug.cpp.