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__)
 Output a line of debugging information.
#define FILE_LINE   __FILE__, __LINE__
#define TIC()
#define TOC(str, count)

Functions

void CDECL debug (const char *dbg, const char *format,...) WARN_FORMAT(2
void CDECL void SetDebugString (const char *s)
 Set debugging levels by parsing the text in s.
const char * GetDebugString ()
 Print out the current debug-level.
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.

Variables

int _debug_ai_level
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_sl_level
int _debug_gamelog_level
int _debug_desync_level
int _debug_console_level
uint32 _realtime_tick
 The real time in the game.

Detailed Description

Functions related to debugging.

Definition in file debug.h.


Define Documentation

#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 37 of file debug.h.

Referenced by _GenerateWorld(), AIOrder::_SetOrderFlags(), TCPListenHandler< ServerNetworkGameSocketHandler, PACKET_SERVER_FULL, PACKET_SERVER_BANNED >::AcceptClient(), SmallSet< Tdir, items >::Add(), Squirrel::AddClassBegin(), TarScanner::AddFile(), BaseMedia< Tbase_set >::AddFile(), AfterLoadGame(), AllocateMap(), AIRail::BuildNewGRFRailStation(), CompanyStationsWindow::BuildStationsList(), Squirrel::CallMethod(), ChangeWorkingDirectory(), CheckCaches(), CheckExternalFiles(), CheckForMissingSprites(), TCPListenHandler< ServerNetworkGameSocketHandler, PACKET_SERVER_FULL, PACKET_SERVER_BANNED >::CloseListeners(), CompactSpriteCache(), NetworkAddress::Connect(), ConnectLoopProc(), AIInfo::Constructor(), convert_from_fs(), convert_to_fs(), Squirrel::CreateClassInstanceVM(), OrderList::DebugCheckSanity(), DEF_UDP_RECEIVE_COMMAND(), DeterminePaths(), AIInstance::Died(), DoAutosave(), DoCommandPInternal(), DoLoad(), DoSave(), TarScanner::DoScan(), Blitter_32bppSimple::DrawColourMappingRect(), Blitter_32bppAnim::DrawColourMappingRect(), DrawString(), ExtractTar(), BaseSet< T, Tnum_files, Tsubdir >::FillSetDetails(), FinalisePriceBaseMultipliers(), CYapfBaseT< Types >::FindPath(), FS2OTTD(), ClientNetworkGameSocketHandler::GameLoop(), GenerateWorld(), AIStation::GetCoverageRadius(), GetDriveableTrackdirBits(), GetLanguageList(), GetRawSprite(), grfmsg(), NetworkHTTPSocketHandler::HandleHeader(), HandleInvalidSpriteRequest(), NetworkGameSocketHandler::HandlePacket(), NetworkContentSocketHandler::HandlePacket(), NetworkAdminSocketHandler::HandlePacket(), NetworkUDPSocketHandler::HandleUDPPacket(), HouseGetVariable(), IConsoleAliasExec(), IConsoleCmdExec(), IndustryGetVariable(), InitQuickTimeIfNeeded(), AIList::IsEnd(), IsGoodGRFConfigList(), IsHouseSpecValid(), TCPListenHandler< ServerNetworkGameSocketHandler, PACKET_SERVER_FULL, PACKET_SERVER_BANNED >::Listen(), ListenLoopProc(), LoadChunk(), AIInstance::LoadCompatibilityScripts(), LoadFreeTypeFont(), LoadFromHighScore(), LoadMovieForMIDIFile(), LoadOldVehicle(), SpriteLoaderGrf::LoadSprite(), AILog::Log(), NetworkAdminCompanyInfo(), NetworkCoreInitialize(), NetworkFindBroadcastIPs(), NetworkGameListAddItem(), NetworkGameListRemoveItem(), NetworkHTTPSocketHandler::NetworkHTTPSocketHandler(), NetworkShutDown(), NetworkStartUp(), NewsDisplayLoadConfig(), AIList::Next(), ObjectGetVariable(), VehicleListWindow::OnTick(), CompanyStationsWindow::OnTick(), OTTD2FS(), OTTDSHGetFolderPath(), MusicDriver_QtMidi::PlaySong(), PositionMainToolbar(), PositionNewsMessage(), PositionStatusbar(), ReadByteFromFile(), ReadSprite(), ReallyDoDrawString(), NetworkHTTPSocketHandler::Receive(), NetworkTCPSocketHandler::ReceivePacket(), NetworkUDPSocketHandler::ReceivePackets(), AIScanner::RegisterAI(), AIScanner::RegisterLibrary(), SquirrelStd::require(), AI::ResetConfig(), NetworkAddress::Resolve(), SafeLoad(), SaveFileToDisk(), SaveOrLoad(), SaveToHighScore(), ScanNewGRFFiles(), BlitterFactoryBase::SelectBlitter(), DriverFactoryBase::SelectDriver(), AIScanner::SelectRandomAI(), ServerNetworkAdminSocketHandler::Send(), NetworkGameSocketHandler::SendCommand(), NetworkUDPSocketHandler::SendPacket(), NetworkTCPSocketHandler::SendPackets(), SetFallbackFont(), SetMIDITypeIfNeeded(), MusicDriver_QtMidi::SetVolume(), ShowNewGrfVehicleError(), SlFixPointers(), SlIterateArray(), SlLoadCheckChunks(), SlLoadChunks(), SlNullPointers(), SlSaveChunk(), SlString(), MusicDriver_QtMidi::Stop(), MusicDriver_QtMidi::StopSong(), strecpy(), TownGetVariable(), TruncateString(), TTDPStringIDToOTTDStringIDMapping(), WarnCorruptSprite(), Backup< T >::~Backup(), and ServerNetworkAdminSocketHandler::~ServerNetworkAdminSocketHandler().

 
#define TIC (  ) 
Value:
{\
  extern uint64 ottd_rdtsc();\
  uint64 _xxx_ = ottd_rdtsc();\
  static uint64 __sum__ = 0;\
  static uint32 __i__ = 0;

Definition at line 85 of file debug.h.

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

Definition at line 91 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 categories.

Returns:
string with debug-levels

Definition at line 189 of file debug.cpp.

References endof, lastof, and strecat().

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.

Returns:
the prefix for logs (do not free), never NULL

Definition at line 212 of file debug.cpp.

References _settings_client, ClientSettings::gui, and GUISettings::show_date_in_logs.

Referenced by debug_print(), and IConsolePrint().

void CDECL 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 135 of file debug.cpp.

References endof, and ShowInfoF().


Variable Documentation


Generated on Fri Feb 4 20:53:52 2011 for OpenTTD by  doxygen 1.6.1