#include "cpu.h"
#include <chrono>
#include "3rdparty/fmt/format.h"
Go to the source code of this file.
|
#define | Debug(name, level, format_string, ...) if ((level) == 0 || _debug_ ## name ## _level >= (level)) DebugPrint(#name, fmt::format(FMT_STRING(format_string), ## __VA_ARGS__)) |
| Ouptut a line of debugging information. More...
|
|
#define | FILE_LINE __FILE__, __LINE__ |
|
#define | TIC() |
|
#define | TOC(str, count) |
|
#define | TICC() |
|
#define | TOCC(str, _count_) |
|
|
void | DebugPrint (const char *level, const std::string &message) |
| Internal function for outputting the debug line. More...
|
|
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, |
|
|
|
format_string, |
|
|
|
... |
|
) |
| if ((level) == 0 || _debug_ ## name ## _level >= (level)) DebugPrint(#name, fmt::format(FMT_STRING(format_string), ## __VA_ARGS__)) |
Ouptut a line of debugging information.
- Parameters
-
name | The category of debug information. |
level | The maximum debug level this message should be shown at. When the debug level for this category is set lower, then the message will not be shown. |
format_string | The formatting string of the message. |
Definition at line 37 of file debug.h.
◆ TIC
Value: {\
static uint64 _sum_ = 0;\
static uint32 _i_ = 0;
Definition at line 90 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 105 of file debug.h.
◆ TOC
#define TOC |
( |
|
str, |
|
|
|
count |
|
) |
| |
Value:
if (++_i_ == count) {\
Debug(misc, 0, "[{}] {} [avg: {:.1f}]", str, _sum_, _sum_/(double)_i_);\
_i_ = 0;\
_sum_ = 0;\
}\
}
Definition at line 95 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, "[{}] {} us [avg: {:.1f} us]", str, _sum_, _sum_/(double)_i_);\
_i_ = 0;\
_sum_ = 0;\
}\
}
Definition at line 110 of file debug.h.
◆ DebugPrint()
void DebugPrint |
( |
const char * |
level, |
|
|
const std::string & |
message |
|
) |
| |
Internal function for outputting the debug line.
- Parameters
-
level | Debug category. |
message | The message to output. |
Definition at line 106 of file debug.cpp.
◆ DumpDebugFacilityNames()
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 198 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 144 of file debug.cpp.