0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-26 16:11:02 +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()
extern const ::profiler::color_t EASY_COLOR_INTERNAL_EVENT;
#ifdef _MSC_VER
::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 {

View File

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

View File

@ -46,7 +46,7 @@
//#define EASY_CODE_WRAP(Code) Code
#ifdef _WIN32
# define __func__ __FUNCTION__
// Visual Studio and MinGW
# ifdef _BUILD_PROFILER
# define PROFILER_API __declspec(dllexport)
# else
@ -60,6 +60,8 @@
//////////////////////////////////////////////////////////////////////////
// Visual Studio
# define __func__ __FUNCTION__
# 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 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_FREE(MEMPTR) free(MEMPTR)
#else
# if defined(_WIN32)
# if defined(_MSC_VER)
# define EASY_ALIGNED(TYPE, VAR, A) __declspec(align(A)) TYPE VAR
# define EASY_MALLOC(MEMSIZE, A) _aligned_malloc(MEMSIZE, A)
# 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::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;
#else
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
// Suppress warnings about double to uint64 conversion
# ifdef _WIN32
# ifdef _MSC_VER
# pragma warning(disable:4244)
# elif defined(__GNUC__)
# 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;
@ -946,7 +946,7 @@ extern "C" {
#undef EASY_CONVERT_TO_NANO
#ifdef EASY_USE_FLOATING_POINT_CONVERSION
# ifdef _WIN32
# ifdef _MSC_VER
# pragma warning(default:4244)
# elif defined(__GNUC__)
# pragma GCC diagnostic pop