Include version.h and CrashReport.h only where needed
[TortoiseGit.git] / src / Utils / DebugHelpers.h
blobe4a1c024c965fbb1d67608e2d6d670695396dd16
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2006 - Stefan Kueng
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #pragma once
21 #ifdef _DEBUG
22 # define BEGIN_TICK { DWORD dwTickMeasureBegin = ::GetTickCount();
23 # define END_TICK(s) DWORD dwTickMeasureEnd = ::GetTickCount(); TRACE("%s: tick count = %d\n", s, dwTickMeasureEnd-dwTickMeasureBegin); }
24 #else
25 # define BEGIN_TICK
26 # define END_TICK(s)
27 #endif
29 /**
30 * \ingroup CommonClasses
31 * returns the string to the given error number.
32 * \param err the error number, obtained with GetLastError() or WSAGetLastError() or ...
34 CString GetLastErrorMessageString(int err);
36 * \ingroup CommonClasses
37 * returns the string to the GetLastError() function.
39 CString GetLastErrorMessageString();
41 #define MS_VC_EXCEPTION 0x406d1388
43 typedef struct tagTHREADNAME_INFO
45 DWORD dwType; // must be 0x1000
46 LPCSTR szName; // pointer to name (in same addr space)
47 DWORD dwThreadID; // thread ID (-1 caller thread)
48 DWORD dwFlags; // reserved for future use, most be zero
49 } THREADNAME_INFO;
51 /**
52 * Sets a name for a thread. The Thread name must not exceed 9 characters!
53 * Inside the current thread you can use -1 for dwThreadID.
54 * \param dwThreadID The Thread ID
55 * \param szThreadName A name for the thread.
57 void SetThreadName(DWORD dwThreadID, LPCTSTR szThreadName);