# debug.h File Reference

Functions related to debugging. More...

Go to the source code of this file.

## Defines
#define | DEBUG(name, level,...) if (level == 0 || _debug_ ## name ## _level >= level) debug(#name, __VA_ARGS__)
#define | OTTD_PRINTF64 "ll"
#define | TIC()
#define | TOC(str, count)
## Functions
void CDECL | debug (const char *dbg,...)
void | SetDebugString (const char *s)
const char * | GetDebugString ()
| Print out the current debug-level Just return a string with the values of all the debug categorites.
void | ShowInfo (const char *str)
void CDECL | ShowInfoF (const char *str,...)
| Shows some information on the console/a popup box depending on the OS.
## Variables
int | _debug_ai_level
int | _debug_driver_level
int | _debug_grf_level
int | _debug_map_level
int | _debug_misc_level
int | _debug_ms_level
int | _debug_net_level
int | _debug_sprite_level
int | _debug_oldloader_level
int | _debug_ntp_level
int | _debug_npf_level
int | _debug_yapf_level
int | _debug_freetype_level
int | _debug_sl_level
int | _debug_station_level
int | _debug_gamelog_level
int | _debug_desync_level

## Detailed Description

Functions related to debugging.

Definition in file debug.h.

## Define Documentation

#define TIC | ( |  | ) |

Value:

    {\
      extern uint64 ottd_rdtsc();\
      uint64 _xxx_ = ottd_rdtsc();\
      static uint64 __sum__ = 0;\
      static uint32 __i__ = 0;

Definition at line 87 of file debug.h.

#define TOC | ( | str,
|  | count |  | ) |

Value:

    __sum__ += ottd_rdtsc() - _xxx_;\
      if (++__i__ == count) {\
        DEBUG(misc, 0, "[%s] %" OTTD_PRINTF64 "u [avg: %.1f]\n", str, __sum__, __sum__/(double)__i__);\
        __i__ = 0;\
        __sum__ = 0;\
      }\
    }

Definition at line 93 of file debug.h.

## Function Documentation

const char* GetDebugString | ( |  | ) |

Print out the current debug-level Just return a string with the values of all the debug categorites.

Returns:
  string with debug-levels

Definition at line 162 of file debug.cpp.

References endof, lastof, and strecat().

void CDECL ShowInfoF | ( | const char * | str,
|  |  | ... |
| ) |  |  |

Shows some information on the console/a popup box depending on the OS.

Parameters:

  | str | the text to show.

Definition at line 123 of file openttd.cpp.

References buf, and lengthof.

Referenced by CheckExternalFiles(), GetKeyboardLayout(), GetSavegameFormat(), ini_load_settings(), IniFile::LoadFromDisk(), ParseResolution(), and string_to_val().