mirror of
https://github.com/yse/easy_profiler.git
synced 2024-12-26 08:01:51 +08:00
#0 Updated copyright dates; [Gui] thread_pool.cpp MSVC build fix; [Core] Renamed getCurrentTime() to profiler::clock::now() + renamed profiler::currentTime() to profiler::now()
This commit is contained in:
parent
1a333e4f01
commit
091d5447ce
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright (c) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright (c) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright (c) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -8,7 +8,7 @@
|
||||
* description : The file contains implementation of profiling blocks
|
||||
* :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
@ -118,7 +118,7 @@ Block::Block(const BaseBlockDescriptor* _descriptor, const char* _runtimeName, b
|
||||
|
||||
void Block::start()
|
||||
{
|
||||
m_begin = getCurrentTime();
|
||||
m_begin = profiler::clock::now();
|
||||
}
|
||||
|
||||
void Block::start(timestamp_t _time) EASY_NOEXCEPT
|
||||
@ -128,7 +128,7 @@ void Block::start(timestamp_t _time) EASY_NOEXCEPT
|
||||
|
||||
void Block::finish()
|
||||
{
|
||||
m_end = getCurrentTime();
|
||||
m_end = profiler::clock::now();
|
||||
}
|
||||
|
||||
void Block::finish(timestamp_t _time) EASY_NOEXCEPT
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
Lightweight profiler library for c++
|
||||
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Licensed under either of
|
||||
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
Lightweight profiler library for c++
|
||||
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Licensed under either of
|
||||
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
Lightweight profiler library for c++
|
||||
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Licensed under either of
|
||||
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
@ -72,7 +72,9 @@ The Apache License, Version 2.0 (the "License");
|
||||
# endif//__ARM_ARCH
|
||||
#endif
|
||||
|
||||
static inline profiler::timestamp_t getCurrentTime()
|
||||
namespace profiler { namespace clock {
|
||||
|
||||
static inline profiler::timestamp_t now()
|
||||
{
|
||||
#if EASY_CHRONO_HIGHRES_CLOCK || EASY_CHRONO_STEADY_CLOCK
|
||||
return (profiler::timestamp_t)EASY_CHRONO_CLOCK::now().time_since_epoch().count();
|
||||
@ -156,13 +158,13 @@ static inline profiler::timestamp_t getCurrentTime()
|
||||
gettimeofday(&tv, nullptr);
|
||||
return static_cast<int64_t>(tv.tv_sec) * 1000000 + tv.tv_usec;
|
||||
#else
|
||||
#warning You need to define fast getCurrentTime() for your OS and CPU
|
||||
#warning You need to define fast now() for your OS and CPU
|
||||
return std::chrono::high_resolution_clock::now().time_since_epoch().count();
|
||||
#define EASY_CHRONO_CLOCK std::chrono::high_resolution_clock
|
||||
#endif
|
||||
|
||||
#else // not _WIN32, __GNUC__, __ICC
|
||||
#warning You need to define fast getCurrentTime() for your OS and CPU
|
||||
#warning You need to define fast now() for your OS and CPU
|
||||
return std::chrono::high_resolution_clock::now().time_since_epoch().count();
|
||||
#define EASY_CHRONO_CLOCK std::chrono::high_resolution_clock
|
||||
#endif
|
||||
@ -170,5 +172,6 @@ static inline profiler::timestamp_t getCurrentTime()
|
||||
#endif
|
||||
}
|
||||
|
||||
} } // end of namespace profiler::clock.
|
||||
|
||||
#endif // EASY_PROFILER_CURRENT_TIME_H
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
Lightweight profiler library for c++
|
||||
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Licensed under either of
|
||||
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -16,7 +16,7 @@
|
||||
* : * 2016/09/17 Victor Zarubkin: added log messages printing.
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
@ -560,7 +560,7 @@ namespace profiler {
|
||||
|
||||
EASY_LOGMSG("Event tracing is stopping...\n");
|
||||
|
||||
TRACING_END_TIME.store(getCurrentTime(), ::std::memory_order_release);
|
||||
TRACING_END_TIME.store(profiler::clock::now(), ::std::memory_order_release);
|
||||
|
||||
ControlTrace(m_openedHandle, KERNEL_LOGGER_NAME, props(), EVENT_TRACE_CONTROL_STOP);
|
||||
CloseTrace(m_openedHandle);
|
||||
|
@ -13,7 +13,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -13,7 +13,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
Lightweight profiler library for c++
|
||||
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Licensed under either of
|
||||
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
Lightweight profiler library for c++
|
||||
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Licensed under either of
|
||||
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
Lightweight profiler library for c++
|
||||
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Licensed under either of
|
||||
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -8,7 +8,7 @@
|
||||
* description : This file contains auxiliary profiler macros for different compiler support.
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -12,7 +12,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
Lightweight profiler library for c++
|
||||
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Licensed under either of
|
||||
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
Lightweight profiler library for c++
|
||||
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Licensed under either of
|
||||
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
Lightweight profiler library for c++
|
||||
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Licensed under either of
|
||||
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
Lightweight profiler library for c++
|
||||
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Licensed under either of
|
||||
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
Lightweight profiler library for c++
|
||||
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Licensed under either of
|
||||
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
@ -469,7 +469,7 @@ namespace profiler {
|
||||
|
||||
\ingroup profiler
|
||||
*/
|
||||
PROFILER_API timestamp_t currentTime();
|
||||
PROFILER_API timestamp_t now();
|
||||
|
||||
/** Convert ticks to nanoseconds.
|
||||
|
||||
@ -771,14 +771,14 @@ namespace profiler {
|
||||
|
||||
}
|
||||
#else
|
||||
inline timestamp_t currentTime() { return 0; }
|
||||
inline timestamp_t toNanoseconds(timestamp_t) { return 0; }
|
||||
inline timestamp_t toMicroseconds(timestamp_t) { return 0; }
|
||||
inline EASY_CONSTEXPR_FCN timestamp_t now() { return 0; }
|
||||
inline EASY_CONSTEXPR_FCN timestamp_t toNanoseconds(timestamp_t) { return 0; }
|
||||
inline EASY_CONSTEXPR_FCN timestamp_t toMicroseconds(timestamp_t) { return 0; }
|
||||
inline const BaseBlockDescriptor* registerDescription(EasyBlockStatus, const char*, const char*, const char*, int, block_type_t, color_t, bool = false)
|
||||
{ return reinterpret_cast<const BaseBlockDescriptor*>(0xbad); }
|
||||
inline void endBlock() { }
|
||||
inline void setEnabled(bool) { }
|
||||
inline bool isEnabled() { return false; }
|
||||
inline EASY_CONSTEXPR_FCN bool isEnabled() { return false; }
|
||||
inline void storeEvent(const BaseBlockDescriptor*, const char* = "") { }
|
||||
inline void storeBlock(const BaseBlockDescriptor*, const char*, timestamp_t, timestamp_t) { }
|
||||
inline void beginBlock(Block&) { }
|
||||
@ -787,26 +787,26 @@ namespace profiler {
|
||||
inline const char* registerThreadScoped(const char*, ThreadGuard&) { return ""; }
|
||||
inline const char* registerThread(const char*) { return ""; }
|
||||
inline void setEventTracingEnabled(bool) { }
|
||||
inline bool isEventTracingEnabled() { return false; }
|
||||
inline EASY_CONSTEXPR_FCN bool isEventTracingEnabled() { return false; }
|
||||
inline void setLowPriorityEventTracing(bool) { }
|
||||
inline bool isLowPriorityEventTracing() { return false; }
|
||||
inline EASY_CONSTEXPR_FCN bool isLowPriorityEventTracing() { return false; }
|
||||
inline void setContextSwitchLogFilename(const char*) { }
|
||||
inline const char* getContextSwitchLogFilename() { return ""; }
|
||||
inline EASY_CONSTEXPR_FCN const char* getContextSwitchLogFilename() { return ""; }
|
||||
inline void startListen(uint16_t = ::profiler::DEFAULT_PORT) { }
|
||||
inline void stopListen() { }
|
||||
inline bool isListening() { return false; }
|
||||
inline uint8_t versionMajor() { return 0; }
|
||||
inline uint8_t versionMinor() { return 0; }
|
||||
inline uint16_t versionPatch() { return 0; }
|
||||
inline uint32_t version() { return 0; }
|
||||
inline const char* versionName() { return "v0.0.0_disabled"; }
|
||||
inline bool isMainThread() { return false; }
|
||||
inline timestamp_t this_thread_frameTime(Duration = ::profiler::MICROSECONDS) { return 0; }
|
||||
inline timestamp_t this_thread_frameTimeLocalMax(Duration = ::profiler::MICROSECONDS) { return 0; }
|
||||
inline timestamp_t this_thread_frameTimeLocalAvg(Duration = ::profiler::MICROSECONDS) { return 0; }
|
||||
inline timestamp_t main_thread_frameTime(Duration = ::profiler::MICROSECONDS) { return 0; }
|
||||
inline timestamp_t main_thread_frameTimeLocalMax(Duration = ::profiler::MICROSECONDS) { return 0; }
|
||||
inline timestamp_t main_thread_frameTimeLocalAvg(Duration = ::profiler::MICROSECONDS) { return 0; }
|
||||
inline EASY_CONSTEXPR_FCN bool isListening() { return false; }
|
||||
inline EASY_CONSTEXPR_FCN uint8_t versionMajor() { return 0; }
|
||||
inline EASY_CONSTEXPR_FCN uint8_t versionMinor() { return 0; }
|
||||
inline EASY_CONSTEXPR_FCN uint16_t versionPatch() { return 0; }
|
||||
inline EASY_CONSTEXPR_FCN uint32_t version() { return 0; }
|
||||
inline EASY_CONSTEXPR_FCN const char* versionName() { return "v0.0.0_disabled"; }
|
||||
inline EASY_CONSTEXPR_FCN bool isMainThread() { return false; }
|
||||
inline EASY_CONSTEXPR_FCN timestamp_t this_thread_frameTime(Duration = ::profiler::MICROSECONDS) { return 0; }
|
||||
inline EASY_CONSTEXPR_FCN timestamp_t this_thread_frameTimeLocalMax(Duration = ::profiler::MICROSECONDS) { return 0; }
|
||||
inline EASY_CONSTEXPR_FCN timestamp_t this_thread_frameTimeLocalAvg(Duration = ::profiler::MICROSECONDS) { return 0; }
|
||||
inline EASY_CONSTEXPR_FCN timestamp_t main_thread_frameTime(Duration = ::profiler::MICROSECONDS) { return 0; }
|
||||
inline EASY_CONSTEXPR_FCN timestamp_t main_thread_frameTimeLocalMax(Duration = ::profiler::MICROSECONDS) { return 0; }
|
||||
inline EASY_CONSTEXPR_FCN timestamp_t main_thread_frameTimeLocalAvg(Duration = ::profiler::MICROSECONDS) { return 0; }
|
||||
#endif
|
||||
|
||||
/** API functions binded to current thread.
|
||||
@ -899,6 +899,12 @@ namespace profiler {
|
||||
*/
|
||||
EASY_FORCE_INLINE void stopCapture() { EASY_PROFILER_DISABLE; }
|
||||
|
||||
/** Alias for now().
|
||||
|
||||
\ingroup profiler
|
||||
*/
|
||||
EASY_FORCE_INLINE timestamp_t currentTime() { return now(); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
} // END of namespace profiler.
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
Lightweight profiler library for c++
|
||||
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Licensed under either of
|
||||
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
Lightweight profiler library for c++
|
||||
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Licensed under either of
|
||||
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
Lightweight profiler library for c++
|
||||
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Licensed under either of
|
||||
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
Lightweight profiler library for c++
|
||||
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Licensed under either of
|
||||
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -12,7 +12,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -8,7 +8,7 @@
|
||||
* description : The file contains implementation of Profile manager and implement access c-function
|
||||
* :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
@ -75,11 +75,11 @@
|
||||
# include <iostream>
|
||||
|
||||
# ifndef EASY_ERRORLOG
|
||||
# define EASY_ERRORLOG ::std::cerr
|
||||
# define EASY_ERRORLOG std::cerr
|
||||
# endif
|
||||
|
||||
# ifndef EASY_LOG
|
||||
# define EASY_LOG ::std::cerr
|
||||
# define EASY_LOG std::cerr
|
||||
# endif
|
||||
|
||||
# ifndef EASY_ERROR
|
||||
@ -188,10 +188,10 @@ static int64_t calculate_cpu_frequency()
|
||||
struct timespec begints, endts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &begints);
|
||||
#endif
|
||||
begin = getCurrentTime();
|
||||
begin = profiler::clock::now();
|
||||
volatile uint64_t i;
|
||||
for (i = 0; i < 100000000; i++); /* must be CPU intensive */
|
||||
end = getCurrentTime();
|
||||
end = profiler::clock::now();
|
||||
#ifdef __APPLE__
|
||||
clock_get_time(cclock, &endts);
|
||||
mach_port_deallocate(mach_task_self(), cclock);
|
||||
@ -245,27 +245,27 @@ thread_local static profiler::ThreadGuard THIS_THREAD_GUARD; // thread guard for
|
||||
|
||||
#ifdef BUILD_WITH_EASY_PROFILER
|
||||
# define EASY_EVENT_RES(res, name, ...)\
|
||||
EASY_LOCAL_STATIC_PTR(const ::profiler::BaseBlockDescriptor*, EASY_UNIQUE_DESC(__LINE__), MANAGER.addBlockDescriptor(\
|
||||
::profiler::extract_enable_flag(__VA_ARGS__), EASY_UNIQUE_LINE_ID, EASY_COMPILETIME_NAME(name),\
|
||||
__FILE__, __LINE__, ::profiler::BlockType::Event, ::profiler::extract_color(__VA_ARGS__)));\
|
||||
EASY_LOCAL_STATIC_PTR(const profiler::BaseBlockDescriptor*, EASY_UNIQUE_DESC(__LINE__), MANAGER.addBlockDescriptor(\
|
||||
profiler::extract_enable_flag(__VA_ARGS__), EASY_UNIQUE_LINE_ID, EASY_COMPILETIME_NAME(name),\
|
||||
__FILE__, __LINE__, profiler::BlockType::Event, profiler::extract_color(__VA_ARGS__)));\
|
||||
res = MANAGER.storeBlock(EASY_UNIQUE_DESC(__LINE__), EASY_RUNTIME_NAME(name))
|
||||
|
||||
# define EASY_FORCE_EVENT(timestamp, name, ...)\
|
||||
EASY_LOCAL_STATIC_PTR(const ::profiler::BaseBlockDescriptor*, EASY_UNIQUE_DESC(__LINE__), addBlockDescriptor(\
|
||||
::profiler::extract_enable_flag(__VA_ARGS__), EASY_UNIQUE_LINE_ID, EASY_COMPILETIME_NAME(name),\
|
||||
__FILE__, __LINE__, ::profiler::BlockType::Event, ::profiler::extract_color(__VA_ARGS__)));\
|
||||
EASY_LOCAL_STATIC_PTR(const profiler::BaseBlockDescriptor*, EASY_UNIQUE_DESC(__LINE__), addBlockDescriptor(\
|
||||
profiler::extract_enable_flag(__VA_ARGS__), EASY_UNIQUE_LINE_ID, EASY_COMPILETIME_NAME(name),\
|
||||
__FILE__, __LINE__, profiler::BlockType::Event, profiler::extract_color(__VA_ARGS__)));\
|
||||
storeBlockForce(EASY_UNIQUE_DESC(__LINE__), EASY_RUNTIME_NAME(name), timestamp)
|
||||
|
||||
# define EASY_FORCE_EVENT2(timestamp, name, ...)\
|
||||
EASY_LOCAL_STATIC_PTR(const ::profiler::BaseBlockDescriptor*, EASY_UNIQUE_DESC(__LINE__), addBlockDescriptor(\
|
||||
::profiler::extract_enable_flag(__VA_ARGS__), EASY_UNIQUE_LINE_ID, EASY_COMPILETIME_NAME(name),\
|
||||
__FILE__, __LINE__, ::profiler::BlockType::Event, ::profiler::extract_color(__VA_ARGS__)));\
|
||||
EASY_LOCAL_STATIC_PTR(const profiler::BaseBlockDescriptor*, EASY_UNIQUE_DESC(__LINE__), addBlockDescriptor(\
|
||||
profiler::extract_enable_flag(__VA_ARGS__), EASY_UNIQUE_LINE_ID, EASY_COMPILETIME_NAME(name),\
|
||||
__FILE__, __LINE__, profiler::BlockType::Event, profiler::extract_color(__VA_ARGS__)));\
|
||||
storeBlockForce2(EASY_UNIQUE_DESC(__LINE__), EASY_RUNTIME_NAME(name), timestamp)
|
||||
|
||||
# define EASY_FORCE_EVENT3(ts, timestamp, name, ...)\
|
||||
EASY_LOCAL_STATIC_PTR(const ::profiler::BaseBlockDescriptor*, EASY_UNIQUE_DESC(__LINE__), addBlockDescriptor(\
|
||||
::profiler::extract_enable_flag(__VA_ARGS__), EASY_UNIQUE_LINE_ID, EASY_COMPILETIME_NAME(name),\
|
||||
__FILE__, __LINE__, ::profiler::BlockType::Event, ::profiler::extract_color(__VA_ARGS__)));\
|
||||
EASY_LOCAL_STATIC_PTR(const profiler::BaseBlockDescriptor*, EASY_UNIQUE_DESC(__LINE__), addBlockDescriptor(\
|
||||
profiler::extract_enable_flag(__VA_ARGS__), EASY_UNIQUE_LINE_ID, EASY_COMPILETIME_NAME(name),\
|
||||
__FILE__, __LINE__, profiler::BlockType::Event, profiler::extract_color(__VA_ARGS__)));\
|
||||
ts.storeBlockForce(profiler::Block(timestamp, timestamp, EASY_UNIQUE_DESC(__LINE__)->id(), EASY_RUNTIME_NAME(name)))
|
||||
#else
|
||||
# ifndef EASY_PROFILER_API_DISABLED
|
||||
@ -282,9 +282,9 @@ thread_local static profiler::ThreadGuard THIS_THREAD_GUARD; // thread guard for
|
||||
extern "C" {
|
||||
|
||||
#if !defined(EASY_PROFILER_API_DISABLED)
|
||||
PROFILER_API timestamp_t currentTime()
|
||||
PROFILER_API timestamp_t now()
|
||||
{
|
||||
return getCurrentTime();
|
||||
return profiler::clock::now();
|
||||
}
|
||||
|
||||
PROFILER_API timestamp_t toNanoseconds(timestamp_t _ticks)
|
||||
@ -480,7 +480,7 @@ extern "C" {
|
||||
}
|
||||
|
||||
#else
|
||||
PROFILER_API timestamp_t currentTime() { return 0; }
|
||||
PROFILER_API timestamp_t now() { return 0; }
|
||||
PROFILER_API timestamp_t toNanoseconds(timestamp_t) { return 0; }
|
||||
PROFILER_API timestamp_t toMicroseconds(timestamp_t) { return 0; }
|
||||
PROFILER_API const BaseBlockDescriptor* registerDescription(EasyBlockStatus, const char*, const char*, const char*, int, block_type_t, color_t, bool) { return reinterpret_cast<const BaseBlockDescriptor*>(0xbad); }
|
||||
@ -637,7 +637,7 @@ ThreadGuard::~ThreadGuard()
|
||||
if (m_id != 0 && THIS_THREAD != nullptr && THIS_THREAD->id == m_id)
|
||||
{
|
||||
bool isMarked = false;
|
||||
EASY_EVENT_RES(isMarked, "ThreadFinished", EASY_COLOR_THREAD_END, ::profiler::FORCE_ON);
|
||||
EASY_EVENT_RES(isMarked, "ThreadFinished", EASY_COLOR_THREAD_END, profiler::FORCE_ON);
|
||||
//THIS_THREAD->markProfilingFrameEnded();
|
||||
THIS_THREAD->putMark();
|
||||
THIS_THREAD->expired.store(isMarked ? 2 : 1, std::memory_order_release);
|
||||
@ -798,7 +798,7 @@ void ProfileManager::storeValue(const BaseBlockDescriptor* _desc, DataType _type
|
||||
return;
|
||||
#endif
|
||||
|
||||
THIS_THREAD->storeValue(getCurrentTime(), _desc->id(), _type, _data, _size, _isArray, _vin);
|
||||
THIS_THREAD->storeValue(profiler::clock::now(), _desc->id(), _type, _data, _size, _isArray, _vin);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -820,7 +820,7 @@ bool ProfileManager::storeBlock(const profiler::BaseBlockDescriptor* _desc, cons
|
||||
return false;
|
||||
#endif
|
||||
|
||||
const auto time = getCurrentTime();
|
||||
const auto time = profiler::clock::now();
|
||||
THIS_THREAD->storeBlock(profiler::Block(time, time, _desc->id(), _runtimeName));
|
||||
THIS_THREAD->putMarkIfEmpty();
|
||||
|
||||
@ -855,7 +855,7 @@ bool ProfileManager::storeBlock(const profiler::BaseBlockDescriptor* _desc, cons
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void ProfileManager::storeBlockForce(const profiler::BaseBlockDescriptor* _desc, const char* _runtimeName, ::profiler::timestamp_t& _timestamp)
|
||||
void ProfileManager::storeBlockForce(const profiler::BaseBlockDescriptor* _desc, const char* _runtimeName, profiler::timestamp_t& _timestamp)
|
||||
{
|
||||
if ((_desc->m_status & profiler::ON) == 0)
|
||||
return;
|
||||
@ -868,12 +868,12 @@ void ProfileManager::storeBlockForce(const profiler::BaseBlockDescriptor* _desc,
|
||||
return;
|
||||
#endif
|
||||
|
||||
_timestamp = getCurrentTime();
|
||||
_timestamp = profiler::clock::now();
|
||||
THIS_THREAD->storeBlock(profiler::Block(_timestamp, _timestamp, _desc->id(), _runtimeName));
|
||||
THIS_THREAD->putMark();
|
||||
}
|
||||
|
||||
void ProfileManager::storeBlockForce2(const profiler::BaseBlockDescriptor* _desc, const char* _runtimeName, ::profiler::timestamp_t _timestamp)
|
||||
void ProfileManager::storeBlockForce2(const profiler::BaseBlockDescriptor* _desc, const char* _runtimeName, profiler::timestamp_t _timestamp)
|
||||
{
|
||||
if ((_desc->m_status & profiler::ON) == 0)
|
||||
return;
|
||||
@ -1152,7 +1152,7 @@ void ProfileManager::setEnabled(bool isEnable)
|
||||
{
|
||||
guard_lock_t lock(m_dumpSpin);
|
||||
|
||||
auto time = getCurrentTime();
|
||||
auto time = profiler::clock::now();
|
||||
if (m_profilerStatus.exchange(isEnable, std::memory_order_acq_rel) == isEnable)
|
||||
return;
|
||||
|
||||
@ -1242,7 +1242,7 @@ uint32_t ProfileManager::dumpBlocksToStream(profiler::OStream& _outputStream, bo
|
||||
{
|
||||
m_profilerStatus.store(false, std::memory_order_release);
|
||||
disableEventTracer();
|
||||
m_endTime = getCurrentTime();
|
||||
m_endTime = profiler::clock::now();
|
||||
}
|
||||
|
||||
if (_async && m_stopDumping.load(std::memory_order_acquire))
|
||||
@ -1265,8 +1265,8 @@ uint32_t ProfileManager::dumpBlocksToStream(profiler::OStream& _outputStream, bo
|
||||
// This is the only place using both spins, so no dead-lock will occur
|
||||
// TODO: think about better solution because this one is not 100% safe...
|
||||
|
||||
const profiler::timestamp_t now = getCurrentTime();
|
||||
const profiler::timestamp_t endtime = m_endTime == 0 ? now : std::min(now, m_endTime);
|
||||
const auto time = profiler::clock::now();
|
||||
const auto endtime = m_endTime == 0 ? time : std::min(time, m_endTime);
|
||||
|
||||
#ifndef _WIN32
|
||||
if (eventTracingEnabled)
|
||||
@ -1485,7 +1485,7 @@ uint32_t ProfileManager::dumpBlocksToFile(const char* _filename)
|
||||
profiler::OStream outputStream;
|
||||
|
||||
// Replace outputStream buffer to outputFile buffer to avoid redundant copying
|
||||
typedef ::std::basic_iostream<std::stringstream::char_type, std::stringstream::traits_type> stringstream_parent;
|
||||
using stringstream_parent = std::basic_iostream<std::stringstream::char_type, std::stringstream::traits_type>;
|
||||
stringstream_parent& s = outputStream.stream();
|
||||
auto oldbuf = s.rdbuf(outputFile.rdbuf());
|
||||
|
||||
@ -1757,7 +1757,7 @@ void ProfileManager::listen(uint16_t _port)
|
||||
{
|
||||
EASY_LOGMSG("receive MessageType::Request_Start_Capture\n");
|
||||
|
||||
::profiler::timestamp_t t = 0;
|
||||
profiler::timestamp_t t = 0;
|
||||
EASY_FORCE_EVENT(t, "StartCapture", EASY_COLOR_START, profiler::OFF);
|
||||
|
||||
m_dumpSpin.lock();
|
||||
@ -1783,7 +1783,7 @@ void ProfileManager::listen(uint16_t _port)
|
||||
break;
|
||||
|
||||
m_dumpSpin.lock();
|
||||
auto time = getCurrentTime();
|
||||
auto time = profiler::clock::now();
|
||||
if (m_profilerStatus.exchange(false, std::memory_order_acq_rel))
|
||||
{
|
||||
disableEventTracer();
|
||||
@ -1877,7 +1877,7 @@ void ProfileManager::listen(uint16_t _port)
|
||||
{
|
||||
auto data = reinterpret_cast<const profiler::net::BlockStatusMessage*>(message);
|
||||
EASY_LOGMSG("receive MessageType::ChangeBLock_Status id=" << data->id << " status=" << data->status << std::endl);
|
||||
setBlockStatus(data->id, static_cast<::profiler::EasyBlockStatus>(data->status));
|
||||
setBlockStatus(data->id, static_cast<profiler::EasyBlockStatus>(data->status));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
Lightweight profiler library for c++
|
||||
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Licensed under either of
|
||||
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -26,7 +26,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -15,8 +15,8 @@ BEGIN
|
||||
BLOCK "080904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "EasySolutions"
|
||||
VALUE "FileDescription", "Lightweight profiler library for c++"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2016-2017 Victor Zarubkin, Sergey Yagovtsev"
|
||||
VALUE "FileDescription", "Lightweight profiler library for C++"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2016-2018 Victor Zarubkin, Sergey Yagovtsev"
|
||||
VALUE "LegalTrademarks1", "All Rights Reserved"
|
||||
VALUE "LegalTrademarks2", "All Rights Reserved"
|
||||
VALUE "ProductName", "easy_profiler lib"
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
Lightweight profiler library for c++
|
||||
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Licensed under either of
|
||||
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
Lightweight profiler library for c++
|
||||
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Licensed under either of
|
||||
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
Lightweight profiler library for c++
|
||||
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Licensed under either of
|
||||
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
@ -91,13 +91,13 @@ void ThreadStorage::storeBlock(const profiler::Block& block)
|
||||
|
||||
#if EASY_OPTION_MEASURE_STORAGE_EXPAND != 0
|
||||
const bool expanded = (desc->m_status & profiler::ON) && blocks.closedList.need_expand(serializedDataSize);
|
||||
if (expanded) beginTime = getCurrentTime();
|
||||
if (expanded) beginTime = profiler::clock::now();
|
||||
#endif
|
||||
|
||||
void* data = blocks.closedList.allocate(serializedDataSize);
|
||||
|
||||
#if EASY_OPTION_MEASURE_STORAGE_EXPAND != 0
|
||||
if (expanded) endTime = getCurrentTime();
|
||||
if (expanded) endTime = profiler::clock::now();
|
||||
#endif
|
||||
|
||||
::new (data) profiler::SerializedBlock(block, nameLength);
|
||||
@ -159,7 +159,7 @@ void ThreadStorage::beginFrame()
|
||||
{
|
||||
if (!frameOpened)
|
||||
{
|
||||
frameStartTime = getCurrentTime();
|
||||
frameStartTime = profiler::clock::now();
|
||||
frameOpened = true;
|
||||
}
|
||||
}
|
||||
@ -167,7 +167,7 @@ void ThreadStorage::beginFrame()
|
||||
profiler::timestamp_t ThreadStorage::endFrame()
|
||||
{
|
||||
frameOpened = false;
|
||||
return getCurrentTime() - frameStartTime;
|
||||
return profiler::clock::now() - frameStartTime;
|
||||
}
|
||||
|
||||
void ThreadStorage::putMark()
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
Lightweight profiler library for c++
|
||||
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
|
||||
Licensed under either of
|
||||
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -12,7 +12,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -12,7 +12,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -24,7 +24,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -20,7 +20,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -21,7 +21,7 @@
|
||||
* : * 2016/08/18 Victor Zarubkin: Moved sources of TreeWidgetItem into tree_widget_item.h/.cpp
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -20,7 +20,7 @@
|
||||
* : Moved sources of TreeWidgetItem into tree_widget_item.h/.cpp
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -12,7 +12,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -12,7 +12,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -13,7 +13,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -13,7 +13,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -13,7 +13,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -12,7 +12,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -13,7 +13,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -12,7 +12,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -12,7 +12,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -12,7 +12,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -13,7 +13,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -12,7 +12,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -12,7 +12,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -13,7 +13,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -13,7 +13,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -12,7 +12,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -12,7 +12,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -12,7 +12,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -12,7 +12,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -8,7 +8,7 @@
|
||||
* description : Main file for EasyProfiler GUI.
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -18,7 +18,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -11,7 +11,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -18,7 +18,7 @@ BEGIN
|
||||
VALUE "CompanyName", "EasySolutions"
|
||||
VALUE "FileDescription", "EasyProfiler"
|
||||
VALUE "InternalName", "profiler_gui"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2016-2017 Victor Zarubkin, Sergey Yagovtsev"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2016-2018 Victor Zarubkin, Sergey Yagovtsev"
|
||||
VALUE "LegalTrademarks1", "All Rights Reserved"
|
||||
VALUE "LegalTrademarks2", "All Rights Reserved"
|
||||
VALUE "OriginalFilename", "profiler_gui.exe"
|
||||
|
@ -1,9 +1,61 @@
|
||||
/*
|
||||
* */
|
||||
/************************************************************************
|
||||
* file name : thread_pool.cpp
|
||||
* ----------------- :
|
||||
* creation time : 2018/01/28
|
||||
* author : Victor Zarubkin
|
||||
* email : v.s.zarubkin@gmail.com
|
||||
* ----------------- :
|
||||
* description : The file contains implementation of ThreadPool.
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
* : * Apache License, Version 2.0, (LICENSE.APACHE or http://www.apache.org/licenses/LICENSE-2.0)
|
||||
* : at your option.
|
||||
* :
|
||||
* : The MIT License
|
||||
* :
|
||||
* : Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* : of this software and associated documentation files (the "Software"), to deal
|
||||
* : in the Software without restriction, including without limitation the rights
|
||||
* : to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* : of the Software, and to permit persons to whom the Software is furnished
|
||||
* : to do so, subject to the following conditions:
|
||||
* :
|
||||
* : The above copyright notice and this permission notice shall be included in all
|
||||
* : copies or substantial portions of the Software.
|
||||
* :
|
||||
* : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* : INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
* : PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* : LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* : TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* : USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
* :
|
||||
* : The Apache License, Version 2.0 (the "License")
|
||||
* :
|
||||
* : You may not use this file except in compliance with the License.
|
||||
* : You may obtain a copy of the License at
|
||||
* :
|
||||
* : http://www.apache.org/licenses/LICENSE-2.0
|
||||
* :
|
||||
* : Unless required by applicable law or agreed to in writing, software
|
||||
* : distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* : See the License for the specific language governing permissions and
|
||||
* : limitations under the License.
|
||||
************************************************************************/
|
||||
|
||||
#include "thread_pool.h"
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// std::back_inserter is defined in <iterator> for Visual C++ ...
|
||||
#include <iterator>
|
||||
#endif
|
||||
|
||||
ThreadPool& ThreadPool::instance()
|
||||
{
|
||||
static ThreadPool pool;
|
||||
|
@ -1,5 +1,52 @@
|
||||
/**
|
||||
* */
|
||||
/************************************************************************
|
||||
* file name : thread_pool.h
|
||||
* ----------------- :
|
||||
* creation time : 2018/01/28
|
||||
* author : Victor Zarubkin
|
||||
* email : v.s.zarubkin@gmail.com
|
||||
* ----------------- :
|
||||
* description : The file contains declaration of ThreadPool.
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
* : * Apache License, Version 2.0, (LICENSE.APACHE or http://www.apache.org/licenses/LICENSE-2.0)
|
||||
* : at your option.
|
||||
* :
|
||||
* : The MIT License
|
||||
* :
|
||||
* : Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* : of this software and associated documentation files (the "Software"), to deal
|
||||
* : in the Software without restriction, including without limitation the rights
|
||||
* : to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* : of the Software, and to permit persons to whom the Software is furnished
|
||||
* : to do so, subject to the following conditions:
|
||||
* :
|
||||
* : The above copyright notice and this permission notice shall be included in all
|
||||
* : copies or substantial portions of the Software.
|
||||
* :
|
||||
* : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* : INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
* : PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* : LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* : TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* : USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
* :
|
||||
* : The Apache License, Version 2.0 (the "License")
|
||||
* :
|
||||
* : You may not use this file except in compliance with the License.
|
||||
* : You may obtain a copy of the License at
|
||||
* :
|
||||
* : http://www.apache.org/licenses/LICENSE-2.0
|
||||
* :
|
||||
* : Unless required by applicable law or agreed to in writing, software
|
||||
* : distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* : See the License for the specific language governing permissions and
|
||||
* : limitations under the License.
|
||||
************************************************************************/
|
||||
|
||||
#ifndef EASY_PROFILER_THREAD_POOL_H
|
||||
#define EASY_PROFILER_THREAD_POOL_H
|
||||
|
@ -1,5 +1,52 @@
|
||||
/**
|
||||
* */
|
||||
/************************************************************************
|
||||
* file name : thread_pool_task.cpp
|
||||
* ----------------- :
|
||||
* creation time : 2018/01/28
|
||||
* author : Victor Zarubkin
|
||||
* email : v.s.zarubkin@gmail.com
|
||||
* ----------------- :
|
||||
* description : The file contains implementation of ThreadPoolTask.
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
* : * Apache License, Version 2.0, (LICENSE.APACHE or http://www.apache.org/licenses/LICENSE-2.0)
|
||||
* : at your option.
|
||||
* :
|
||||
* : The MIT License
|
||||
* :
|
||||
* : Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* : of this software and associated documentation files (the "Software"), to deal
|
||||
* : in the Software without restriction, including without limitation the rights
|
||||
* : to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* : of the Software, and to permit persons to whom the Software is furnished
|
||||
* : to do so, subject to the following conditions:
|
||||
* :
|
||||
* : The above copyright notice and this permission notice shall be included in all
|
||||
* : copies or substantial portions of the Software.
|
||||
* :
|
||||
* : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* : INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
* : PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* : LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* : TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* : USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
* :
|
||||
* : The Apache License, Version 2.0 (the "License")
|
||||
* :
|
||||
* : You may not use this file except in compliance with the License.
|
||||
* : You may obtain a copy of the License at
|
||||
* :
|
||||
* : http://www.apache.org/licenses/LICENSE-2.0
|
||||
* :
|
||||
* : Unless required by applicable law or agreed to in writing, software
|
||||
* : distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* : See the License for the specific language governing permissions and
|
||||
* : limitations under the License.
|
||||
************************************************************************/
|
||||
|
||||
#include "thread_pool_task.h"
|
||||
#include "thread_pool.h"
|
||||
|
@ -1,5 +1,52 @@
|
||||
/*
|
||||
* */
|
||||
/************************************************************************
|
||||
* file name : thread_pool_task.h
|
||||
* ----------------- :
|
||||
* creation time : 2018/01/28
|
||||
* author : Victor Zarubkin
|
||||
* email : v.s.zarubkin@gmail.com
|
||||
* ----------------- :
|
||||
* description : The file contains declaration of ThreadPoolTask.
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
* : * Apache License, Version 2.0, (LICENSE.APACHE or http://www.apache.org/licenses/LICENSE-2.0)
|
||||
* : at your option.
|
||||
* :
|
||||
* : The MIT License
|
||||
* :
|
||||
* : Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* : of this software and associated documentation files (the "Software"), to deal
|
||||
* : in the Software without restriction, including without limitation the rights
|
||||
* : to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* : of the Software, and to permit persons to whom the Software is furnished
|
||||
* : to do so, subject to the following conditions:
|
||||
* :
|
||||
* : The above copyright notice and this permission notice shall be included in all
|
||||
* : copies or substantial portions of the Software.
|
||||
* :
|
||||
* : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* : INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
* : PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* : LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* : TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* : USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
* :
|
||||
* : The Apache License, Version 2.0 (the "License")
|
||||
* :
|
||||
* : You may not use this file except in compliance with the License.
|
||||
* : You may obtain a copy of the License at
|
||||
* :
|
||||
* : http://www.apache.org/licenses/LICENSE-2.0
|
||||
* :
|
||||
* : Unless required by applicable law or agreed to in writing, software
|
||||
* : distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* : See the License for the specific language governing permissions and
|
||||
* : limitations under the License.
|
||||
************************************************************************/
|
||||
|
||||
#ifndef EASY_PROFILER_THREAD_POOL_TASK_H
|
||||
#define EASY_PROFILER_THREAD_POOL_TASK_H
|
||||
|
@ -13,7 +13,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -14,7 +14,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -14,7 +14,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -14,7 +14,7 @@
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
|
||||
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : Licensed under either of
|
||||
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <sys/time.h>
|
||||
|
||||
|
||||
static inline uint64_t getCurrentTime()
|
||||
static inline uint64_t now()
|
||||
{
|
||||
#if defined(__i386__)
|
||||
int64_t ret;
|
||||
@ -34,10 +34,10 @@ int64_t calculate_cpu_frequency()//per sec
|
||||
struct timespec begints, endts;
|
||||
uint64_t begin = 0, end = 0;
|
||||
clock_gettime(CLOCK_MONOTONIC, &begints);
|
||||
begin = getCurrentTime();
|
||||
begin = now();
|
||||
volatile uint64_t i;
|
||||
for (i = 0; i < 100000000; i++); /* must be CPU intensive */
|
||||
end = getCurrentTime();
|
||||
end = now();
|
||||
clock_gettime(CLOCK_MONOTONIC, &endts);
|
||||
struct timespec tmpts;
|
||||
const int NANO_SECONDS_IN_SEC = 1000000000;
|
||||
@ -102,15 +102,15 @@ double calcDuration(int objects)
|
||||
|
||||
uint64_t calcDeltaRdtsc(int magic=200000)
|
||||
{
|
||||
auto start = getCurrentTime();
|
||||
auto start = now();
|
||||
localSleep(magic);
|
||||
auto end = getCurrentTime();
|
||||
auto end = now();
|
||||
return end - start;
|
||||
}
|
||||
|
||||
double calcDurationByRdtsc(int objects)
|
||||
{
|
||||
auto start = getCurrentTime();
|
||||
auto start = now();
|
||||
|
||||
uint64_t summ = 0;
|
||||
|
||||
@ -119,7 +119,7 @@ double calcDurationByRdtsc(int objects)
|
||||
summ += calcDeltaRdtsc();
|
||||
}
|
||||
|
||||
auto end = getCurrentTime();
|
||||
auto end = now();
|
||||
return TICKS_TO_US((end - start - summ))/double(objects)/2.0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user