|
3 | 3 |
|
4 | 4 | #pragma once |
5 | 5 |
|
6 | | -#ifndef _DEBUG |
7 | | -# undef ENABLE_MEMORY_PROFILING |
8 | | -#endif |
9 | | - |
10 | | -#ifdef _WIN32 |
11 | | -# ifndef WIN32_LEAN_AND_MEAN |
12 | | -# error Requires WIN32_LEAN_AND_MEAN definition |
13 | | -# endif |
14 | | -# ifndef NOMINMAX |
15 | | -# error Requires NOMINMAX definition |
16 | | -# endif |
17 | | -# include <windows.h> |
18 | | -# include <io.h> |
19 | | -# include <fcntl.h> |
20 | | -# include <clocale> |
21 | | -# if defined(ENABLE_MEMORY_PROFILING) && defined(_DEBUG) && (defined(_MSC_VER) || defined(__clang__)) |
22 | | -# include <crtdbg.h> |
23 | | -# include <iostream> |
24 | | -# else |
25 | | -# undef ENABLE_MEMORY_PROFILING |
26 | | -# endif |
27 | | -#else |
28 | | -# undef ENABLE_MEMORY_PROFILING |
29 | | -#endif |
30 | | - |
31 | | -inline void config_console() { |
32 | | -#ifdef _WIN32 |
33 | | - ::SetConsoleOutputCP(CP_UTF8); |
34 | | - ::SetConsoleCP(CP_UTF8); |
35 | | - ::setlocale(LC_ALL, ".UTF8"); |
36 | | -#endif |
37 | | -} |
38 | | - |
39 | | -inline void config_profiler() { |
40 | | -#ifdef ENABLE_MEMORY_PROFILING |
41 | | - std::cout << "!! Enabled memory profiling !!" << std::endl; |
42 | | - constexpr auto report_mode = /*_CRTDBG_MODE_DEBUG |*/ _CRTDBG_MODE_FILE /*| _CRTDBG_MODE_WNDW*/; |
43 | | - ::_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF); |
44 | | - ::_CrtSetReportMode(_CRT_ASSERT, report_mode); |
45 | | - ::_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); |
46 | | - ::_CrtSetReportMode(_CRT_WARN, report_mode); |
47 | | - ::_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); |
48 | | - ::_CrtSetReportMode(_CRT_ERROR, report_mode); |
49 | | - ::_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); |
50 | | -#endif |
51 | | -} |
52 | | - |
53 | 6 | #include "types.hpp" |
54 | 7 | #include <cassert> |
55 | | -#include <thread> |
56 | 8 | #include <algorithm> |
| 9 | +#include <thread> |
57 | 10 |
|
58 | 11 | namespace test::config { |
59 | 12 | struct prelim { |
|
0 commit comments