0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-28 01:04:41 +08:00

MinGW adaptation first try

This commit is contained in:
Victor Zarubkin 2017-02-13 20:19:41 +03:00
parent 11fbfe65d4
commit d54ef45c3a
5 changed files with 15 additions and 7 deletions

View File

@ -111,7 +111,12 @@
#define MANAGER ProfileManager::instance() #define MANAGER ProfileManager::instance()
extern const ::profiler::color_t EASY_COLOR_INTERNAL_EVENT; extern const ::profiler::color_t EASY_COLOR_INTERNAL_EVENT;
#ifdef _MSC_VER
::std::atomic_uint64_t TRACING_END_TIME = ATOMIC_VAR_INIT(~0ULL); ::std::atomic_uint64_t TRACING_END_TIME = ATOMIC_VAR_INIT(~0ULL);
#else
::std::atomic<uint64_t> TRACING_END_TIME = ATOMIC_VAR_INIT(~0ULL);
#endif
namespace profiler { namespace profiler {

View File

@ -39,7 +39,8 @@
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
#ifdef _WIN32 #if defined(_MSC_VER)// && _MSC_VER >= 1800
# define EASY_PROFILER_HASHED_CSTR_DEFINED
namespace profiler { namespace profiler {

View File

@ -46,7 +46,7 @@
//#define EASY_CODE_WRAP(Code) Code //#define EASY_CODE_WRAP(Code) Code
#ifdef _WIN32 #ifdef _WIN32
# define __func__ __FUNCTION__ // Visual Studio and MinGW
# ifdef _BUILD_PROFILER # ifdef _BUILD_PROFILER
# define PROFILER_API __declspec(dllexport) # define PROFILER_API __declspec(dllexport)
# else # else
@ -60,6 +60,8 @@
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// Visual Studio // Visual Studio
# define __func__ __FUNCTION__
# if _MSC_VER <= 1800 # if _MSC_VER <= 1800
// There is no support for C++11 thread_local keyword prior to Visual Studio 2015. Use __declspec(thread) instead. // There is no support for C++11 thread_local keyword prior to Visual Studio 2015. Use __declspec(thread) instead.
// There is also no support for C++11 magic statics feature :( So it becomes slightly harder to initialize static vars - additional "if" for each profiler block. // There is also no support for C++11 magic statics feature :( So it becomes slightly harder to initialize static vars - additional "if" for each profiler block.

View File

@ -100,7 +100,7 @@ namespace profiler {
# define EASY_MALLOC(MEMSIZE, A) malloc(MEMSIZE) # define EASY_MALLOC(MEMSIZE, A) malloc(MEMSIZE)
# define EASY_FREE(MEMPTR) free(MEMPTR) # define EASY_FREE(MEMPTR) free(MEMPTR)
#else #else
# if defined(_WIN32) # if defined(_MSC_VER)
# define EASY_ALIGNED(TYPE, VAR, A) __declspec(align(A)) TYPE VAR # define EASY_ALIGNED(TYPE, VAR, A) __declspec(align(A)) TYPE VAR
# define EASY_MALLOC(MEMSIZE, A) _aligned_malloc(MEMSIZE, A) # define EASY_MALLOC(MEMSIZE, A) _aligned_malloc(MEMSIZE, A)
# define EASY_FREE(MEMPTR) _aligned_free(MEMPTR) # define EASY_FREE(MEMPTR) _aligned_free(MEMPTR)
@ -353,7 +353,7 @@ class ProfileManager
typedef std::map<profiler::thread_id_t, ThreadStorage> map_of_threads_stacks; typedef std::map<profiler::thread_id_t, ThreadStorage> map_of_threads_stacks;
typedef std::vector<BlockDescriptor*> block_descriptors_t; typedef std::vector<BlockDescriptor*> block_descriptors_t;
#ifdef _WIN32 #ifdef EASY_PROFILER_HASHED_CSTR_DEFINED
typedef std::unordered_map<profiler::hashed_cstr, profiler::block_id_t> descriptors_map_t; typedef std::unordered_map<profiler::hashed_cstr, profiler::block_id_t> descriptors_map_t;
#else #else
typedef std::unordered_map<profiler::hashed_stdstring, profiler::block_id_t> descriptors_map_t; typedef std::unordered_map<profiler::hashed_stdstring, profiler::block_id_t> descriptors_map_t;

View File

@ -91,7 +91,7 @@ const uint64_t TIME_FACTOR = 1000000000ULL;
#ifdef EASY_USE_FLOATING_POINT_CONVERSION #ifdef EASY_USE_FLOATING_POINT_CONVERSION
// Suppress warnings about double to uint64 conversion // Suppress warnings about double to uint64 conversion
# ifdef _WIN32 # ifdef _MSC_VER
# pragma warning(disable:4244) # pragma warning(disable:4244)
# elif defined(__GNUC__) # elif defined(__GNUC__)
# pragma GCC diagnostic push # pragma GCC diagnostic push
@ -181,7 +181,7 @@ namespace profiler {
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
#ifdef _WIN32 #ifdef EASY_PROFILER_HASHED_CSTR_DEFINED
typedef ::std::unordered_map<::profiler::block_id_t, ::profiler::BlockStatistics*, ::profiler::passthrough_hash> StatsMap; typedef ::std::unordered_map<::profiler::block_id_t, ::profiler::BlockStatistics*, ::profiler::passthrough_hash> StatsMap;
@ -946,7 +946,7 @@ extern "C" {
#undef EASY_CONVERT_TO_NANO #undef EASY_CONVERT_TO_NANO
#ifdef EASY_USE_FLOATING_POINT_CONVERSION #ifdef EASY_USE_FLOATING_POINT_CONVERSION
# ifdef _WIN32 # ifdef _MSC_VER
# pragma warning(default:4244) # pragma warning(default:4244)
# elif defined(__GNUC__) # elif defined(__GNUC__)
# pragma GCC diagnostic pop # pragma GCC diagnostic pop