From 091d5447ce90aab5fcff1cda46b95a6ace7f85f2 Mon Sep 17 00:00:00 2001 From: Victor Zarubkin Date: Mon, 29 Jan 2018 23:29:43 +0300 Subject: [PATCH] #0 Updated copyright dates; [Gui] thread_pool.cpp MSVC build fix; [Core] Renamed getCurrentTime() to profiler::clock::now() + renamed profiler::currentTime() to profiler::now() --- LICENSE | 2 +- LICENSE.MIT | 2 +- easy_profiler_core/LICENSE.MIT | 2 +- easy_profiler_core/block.cpp | 6 +- easy_profiler_core/chunk_allocator.h | 2 +- easy_profiler_core/current_thread.h | 2 +- easy_profiler_core/current_time.h | 11 +-- easy_profiler_core/easy_socket.cpp | 2 +- easy_profiler_core/event_trace_win.cpp | 4 +- easy_profiler_core/event_trace_win.h | 2 +- easy_profiler_core/hashed_cstr.h | 2 +- .../include/easy/arbitrary_value.h | 2 +- .../easy/details/arbitrary_value_aux.h | 2 +- .../details/arbitrary_value_public_types.h | 2 +- .../easy/details/easy_compiler_support.h | 2 +- .../include/easy/details/profiler_aux.h | 2 +- .../include/easy/details/profiler_colors.h | 2 +- .../easy/details/profiler_public_types.h | 2 +- easy_profiler_core/include/easy/easy_net.h | 2 +- easy_profiler_core/include/easy/easy_socket.h | 2 +- easy_profiler_core/include/easy/profiler.h | 50 ++++++++------ easy_profiler_core/include/easy/reader.h | 2 +- .../include/easy/serialized_block.h | 2 +- easy_profiler_core/nonscoped_block.cpp | 2 +- easy_profiler_core/nonscoped_block.h | 2 +- easy_profiler_core/outstream.h | 2 +- easy_profiler_core/profile_manager.cpp | 68 +++++++++---------- easy_profiler_core/profile_manager.h | 2 +- easy_profiler_core/reader.cpp | 2 +- easy_profiler_core/resources.rc | 4 +- easy_profiler_core/spin_lock.h | 2 +- easy_profiler_core/stack_buffer.h | 2 +- easy_profiler_core/thread_storage.cpp | 10 +-- easy_profiler_core/thread_storage.h | 2 +- profiler_gui/arbitrary_value_inspector.cpp | 2 +- profiler_gui/arbitrary_value_inspector.h | 2 +- profiler_gui/blocks_graphics_view.cpp | 2 +- profiler_gui/blocks_graphics_view.h | 2 +- profiler_gui/blocks_tree_widget.cpp | 2 +- profiler_gui/blocks_tree_widget.h | 2 +- profiler_gui/common_functions.cpp | 2 +- profiler_gui/common_functions.h | 2 +- profiler_gui/common_types.h | 2 +- profiler_gui/descriptors_tree_widget.cpp | 2 +- profiler_gui/descriptors_tree_widget.h | 2 +- profiler_gui/easy_chronometer_item.cpp | 2 +- profiler_gui/easy_chronometer_item.h | 2 +- profiler_gui/easy_frame_rate_viewer.cpp | 2 +- profiler_gui/easy_frame_rate_viewer.h | 2 +- profiler_gui/easy_graphics_item.cpp | 2 +- profiler_gui/easy_graphics_item.h | 2 +- profiler_gui/easy_graphics_scrollbar.cpp | 2 +- profiler_gui/easy_graphics_scrollbar.h | 2 +- profiler_gui/easy_qtimer.cpp | 2 +- profiler_gui/easy_qtimer.h | 2 +- profiler_gui/globals.cpp | 2 +- profiler_gui/globals.h | 2 +- profiler_gui/globals_qobjects.cpp | 2 +- profiler_gui/globals_qobjects.h | 2 +- profiler_gui/graphics_image_item.h | 2 +- profiler_gui/main.cpp | 2 +- profiler_gui/main_window.cpp | 2 +- profiler_gui/main_window.h | 2 +- profiler_gui/resources.rc | 2 +- profiler_gui/thread_pool.cpp | 56 ++++++++++++++- profiler_gui/thread_pool.h | 51 +++++++++++++- profiler_gui/thread_pool_task.cpp | 51 +++++++++++++- profiler_gui/thread_pool_task.h | 51 +++++++++++++- profiler_gui/tree_widget_item.cpp | 2 +- profiler_gui/tree_widget_item.h | 2 +- profiler_gui/tree_widget_loader.cpp | 2 +- profiler_gui/tree_widget_loader.h | 2 +- sample/main_clock.cpp | 14 ++-- 73 files changed, 350 insertions(+), 148 deletions(-) diff --git a/LICENSE b/LICENSE index 8615acd..31643de 100644 --- a/LICENSE +++ b/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 diff --git a/LICENSE.MIT b/LICENSE.MIT index 3840145..dac631a 100644 --- a/LICENSE.MIT +++ b/LICENSE.MIT @@ -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 diff --git a/easy_profiler_core/LICENSE.MIT b/easy_profiler_core/LICENSE.MIT index 3840145..dac631a 100644 --- a/easy_profiler_core/LICENSE.MIT +++ b/easy_profiler_core/LICENSE.MIT @@ -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 diff --git a/easy_profiler_core/block.cpp b/easy_profiler_core/block.cpp index ffc518d..2b2ead2 100644 --- a/easy_profiler_core/block.cpp +++ b/easy_profiler_core/block.cpp @@ -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 diff --git a/easy_profiler_core/chunk_allocator.h b/easy_profiler_core/chunk_allocator.h index 7c643fd..8e03b50 100644 --- a/easy_profiler_core/chunk_allocator.h +++ b/easy_profiler_core/chunk_allocator.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) diff --git a/easy_profiler_core/current_thread.h b/easy_profiler_core/current_thread.h index 816979c..fe465c1 100644 --- a/easy_profiler_core/current_thread.h +++ b/easy_profiler_core/current_thread.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) diff --git a/easy_profiler_core/current_time.h b/easy_profiler_core/current_time.h index b08224e..5a612c3 100644 --- a/easy_profiler_core/current_time.h +++ b/easy_profiler_core/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) @@ -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(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 diff --git a/easy_profiler_core/easy_socket.cpp b/easy_profiler_core/easy_socket.cpp index ab2f5eb..826e7d8 100644 --- a/easy_profiler_core/easy_socket.cpp +++ b/easy_profiler_core/easy_socket.cpp @@ -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) diff --git a/easy_profiler_core/event_trace_win.cpp b/easy_profiler_core/event_trace_win.cpp index 0927f63..01e8862 100644 --- a/easy_profiler_core/event_trace_win.cpp +++ b/easy_profiler_core/event_trace_win.cpp @@ -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); diff --git a/easy_profiler_core/event_trace_win.h b/easy_profiler_core/event_trace_win.h index 1692891..a077344 100644 --- a/easy_profiler_core/event_trace_win.h +++ b/easy_profiler_core/event_trace_win.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) diff --git a/easy_profiler_core/hashed_cstr.h b/easy_profiler_core/hashed_cstr.h index 075f2b1..6618341 100644 --- a/easy_profiler_core/hashed_cstr.h +++ b/easy_profiler_core/hashed_cstr.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) diff --git a/easy_profiler_core/include/easy/arbitrary_value.h b/easy_profiler_core/include/easy/arbitrary_value.h index 9e1305b..36a1899 100644 --- a/easy_profiler_core/include/easy/arbitrary_value.h +++ b/easy_profiler_core/include/easy/arbitrary_value.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) diff --git a/easy_profiler_core/include/easy/details/arbitrary_value_aux.h b/easy_profiler_core/include/easy/details/arbitrary_value_aux.h index 2f8506e..50ac8a1 100644 --- a/easy_profiler_core/include/easy/details/arbitrary_value_aux.h +++ b/easy_profiler_core/include/easy/details/arbitrary_value_aux.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) diff --git a/easy_profiler_core/include/easy/details/arbitrary_value_public_types.h b/easy_profiler_core/include/easy/details/arbitrary_value_public_types.h index c2851cb..8294a43 100644 --- a/easy_profiler_core/include/easy/details/arbitrary_value_public_types.h +++ b/easy_profiler_core/include/easy/details/arbitrary_value_public_types.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) diff --git a/easy_profiler_core/include/easy/details/easy_compiler_support.h b/easy_profiler_core/include/easy/details/easy_compiler_support.h index 6d9fe8d..212359d 100644 --- a/easy_profiler_core/include/easy/details/easy_compiler_support.h +++ b/easy_profiler_core/include/easy/details/easy_compiler_support.h @@ -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) diff --git a/easy_profiler_core/include/easy/details/profiler_aux.h b/easy_profiler_core/include/easy/details/profiler_aux.h index 9b8da6c..fec0cf4 100644 --- a/easy_profiler_core/include/easy/details/profiler_aux.h +++ b/easy_profiler_core/include/easy/details/profiler_aux.h @@ -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) diff --git a/easy_profiler_core/include/easy/details/profiler_colors.h b/easy_profiler_core/include/easy/details/profiler_colors.h index 61e8b5b..af756c1 100644 --- a/easy_profiler_core/include/easy/details/profiler_colors.h +++ b/easy_profiler_core/include/easy/details/profiler_colors.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) diff --git a/easy_profiler_core/include/easy/details/profiler_public_types.h b/easy_profiler_core/include/easy/details/profiler_public_types.h index d19af70..25cb13a 100644 --- a/easy_profiler_core/include/easy/details/profiler_public_types.h +++ b/easy_profiler_core/include/easy/details/profiler_public_types.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) diff --git a/easy_profiler_core/include/easy/easy_net.h b/easy_profiler_core/include/easy/easy_net.h index cf2d092..164d295 100644 --- a/easy_profiler_core/include/easy/easy_net.h +++ b/easy_profiler_core/include/easy/easy_net.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) diff --git a/easy_profiler_core/include/easy/easy_socket.h b/easy_profiler_core/include/easy/easy_socket.h index 064ba6a..5059dae 100644 --- a/easy_profiler_core/include/easy/easy_socket.h +++ b/easy_profiler_core/include/easy/easy_socket.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) diff --git a/easy_profiler_core/include/easy/profiler.h b/easy_profiler_core/include/easy/profiler.h index dffc525..b059813 100644 --- a/easy_profiler_core/include/easy/profiler.h +++ b/easy_profiler_core/include/easy/profiler.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) @@ -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(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. diff --git a/easy_profiler_core/include/easy/reader.h b/easy_profiler_core/include/easy/reader.h index cbfe414..50a14f4 100644 --- a/easy_profiler_core/include/easy/reader.h +++ b/easy_profiler_core/include/easy/reader.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) diff --git a/easy_profiler_core/include/easy/serialized_block.h b/easy_profiler_core/include/easy/serialized_block.h index dd07711..1708c72 100644 --- a/easy_profiler_core/include/easy/serialized_block.h +++ b/easy_profiler_core/include/easy/serialized_block.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) diff --git a/easy_profiler_core/nonscoped_block.cpp b/easy_profiler_core/nonscoped_block.cpp index 6fa5d77..235dbf8 100644 --- a/easy_profiler_core/nonscoped_block.cpp +++ b/easy_profiler_core/nonscoped_block.cpp @@ -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) diff --git a/easy_profiler_core/nonscoped_block.h b/easy_profiler_core/nonscoped_block.h index 5655f5a..93149b3 100644 --- a/easy_profiler_core/nonscoped_block.h +++ b/easy_profiler_core/nonscoped_block.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) diff --git a/easy_profiler_core/outstream.h b/easy_profiler_core/outstream.h index f27762d..a050e0a 100644 --- a/easy_profiler_core/outstream.h +++ b/easy_profiler_core/outstream.h @@ -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) diff --git a/easy_profiler_core/profile_manager.cpp b/easy_profiler_core/profile_manager.cpp index 2cef32c..3894968 100644 --- a/easy_profiler_core/profile_manager.cpp +++ b/easy_profiler_core/profile_manager.cpp @@ -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 # 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(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 stringstream_parent; + using stringstream_parent = std::basic_iostream; 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(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(data->status)); break; } diff --git a/easy_profiler_core/profile_manager.h b/easy_profiler_core/profile_manager.h index f42b0a2..24abc1d 100644 --- a/easy_profiler_core/profile_manager.h +++ b/easy_profiler_core/profile_manager.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) diff --git a/easy_profiler_core/reader.cpp b/easy_profiler_core/reader.cpp index 9fc6009..31d53f1 100644 --- a/easy_profiler_core/reader.cpp +++ b/easy_profiler_core/reader.cpp @@ -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) diff --git a/easy_profiler_core/resources.rc b/easy_profiler_core/resources.rc index e68eb4d..26e7a92 100644 --- a/easy_profiler_core/resources.rc +++ b/easy_profiler_core/resources.rc @@ -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" diff --git a/easy_profiler_core/spin_lock.h b/easy_profiler_core/spin_lock.h index 705540d..79f5685 100644 --- a/easy_profiler_core/spin_lock.h +++ b/easy_profiler_core/spin_lock.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) diff --git a/easy_profiler_core/stack_buffer.h b/easy_profiler_core/stack_buffer.h index a59ad06..cb37680 100644 --- a/easy_profiler_core/stack_buffer.h +++ b/easy_profiler_core/stack_buffer.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) diff --git a/easy_profiler_core/thread_storage.cpp b/easy_profiler_core/thread_storage.cpp index f716a53..9aa2f7e 100644 --- a/easy_profiler_core/thread_storage.cpp +++ b/easy_profiler_core/thread_storage.cpp @@ -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() diff --git a/easy_profiler_core/thread_storage.h b/easy_profiler_core/thread_storage.h index abdf936..699be59 100644 --- a/easy_profiler_core/thread_storage.h +++ b/easy_profiler_core/thread_storage.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) diff --git a/profiler_gui/arbitrary_value_inspector.cpp b/profiler_gui/arbitrary_value_inspector.cpp index ae9064b..20a2df6 100644 --- a/profiler_gui/arbitrary_value_inspector.cpp +++ b/profiler_gui/arbitrary_value_inspector.cpp @@ -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) diff --git a/profiler_gui/arbitrary_value_inspector.h b/profiler_gui/arbitrary_value_inspector.h index 5bb8d67..16f9be5 100644 --- a/profiler_gui/arbitrary_value_inspector.h +++ b/profiler_gui/arbitrary_value_inspector.h @@ -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) diff --git a/profiler_gui/blocks_graphics_view.cpp b/profiler_gui/blocks_graphics_view.cpp index 53ee5b8..b8f1c30 100644 --- a/profiler_gui/blocks_graphics_view.cpp +++ b/profiler_gui/blocks_graphics_view.cpp @@ -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) diff --git a/profiler_gui/blocks_graphics_view.h b/profiler_gui/blocks_graphics_view.h index 4505421..586e368 100644 --- a/profiler_gui/blocks_graphics_view.h +++ b/profiler_gui/blocks_graphics_view.h @@ -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) diff --git a/profiler_gui/blocks_tree_widget.cpp b/profiler_gui/blocks_tree_widget.cpp index 29f9856..da9a97d 100644 --- a/profiler_gui/blocks_tree_widget.cpp +++ b/profiler_gui/blocks_tree_widget.cpp @@ -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) diff --git a/profiler_gui/blocks_tree_widget.h b/profiler_gui/blocks_tree_widget.h index 8388ed0..eb208b3 100644 --- a/profiler_gui/blocks_tree_widget.h +++ b/profiler_gui/blocks_tree_widget.h @@ -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) diff --git a/profiler_gui/common_functions.cpp b/profiler_gui/common_functions.cpp index 9d89867..ebdd287 100644 --- a/profiler_gui/common_functions.cpp +++ b/profiler_gui/common_functions.cpp @@ -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) diff --git a/profiler_gui/common_functions.h b/profiler_gui/common_functions.h index 2fbfe6d..423b85e 100644 --- a/profiler_gui/common_functions.h +++ b/profiler_gui/common_functions.h @@ -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) diff --git a/profiler_gui/common_types.h b/profiler_gui/common_types.h index 6102a56..bfa384b 100644 --- a/profiler_gui/common_types.h +++ b/profiler_gui/common_types.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) diff --git a/profiler_gui/descriptors_tree_widget.cpp b/profiler_gui/descriptors_tree_widget.cpp index 4a04ce8..7bdfd7f 100644 --- a/profiler_gui/descriptors_tree_widget.cpp +++ b/profiler_gui/descriptors_tree_widget.cpp @@ -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) diff --git a/profiler_gui/descriptors_tree_widget.h b/profiler_gui/descriptors_tree_widget.h index 7c1ff0f..395eb09 100644 --- a/profiler_gui/descriptors_tree_widget.h +++ b/profiler_gui/descriptors_tree_widget.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) diff --git a/profiler_gui/easy_chronometer_item.cpp b/profiler_gui/easy_chronometer_item.cpp index 21eb427..6793a83 100644 --- a/profiler_gui/easy_chronometer_item.cpp +++ b/profiler_gui/easy_chronometer_item.cpp @@ -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) diff --git a/profiler_gui/easy_chronometer_item.h b/profiler_gui/easy_chronometer_item.h index de604f2..59fe875 100644 --- a/profiler_gui/easy_chronometer_item.h +++ b/profiler_gui/easy_chronometer_item.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) diff --git a/profiler_gui/easy_frame_rate_viewer.cpp b/profiler_gui/easy_frame_rate_viewer.cpp index b960d8c..39439fe 100644 --- a/profiler_gui/easy_frame_rate_viewer.cpp +++ b/profiler_gui/easy_frame_rate_viewer.cpp @@ -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) diff --git a/profiler_gui/easy_frame_rate_viewer.h b/profiler_gui/easy_frame_rate_viewer.h index a66198f..602d615 100644 --- a/profiler_gui/easy_frame_rate_viewer.h +++ b/profiler_gui/easy_frame_rate_viewer.h @@ -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) diff --git a/profiler_gui/easy_graphics_item.cpp b/profiler_gui/easy_graphics_item.cpp index cc48095..f80e7e7 100644 --- a/profiler_gui/easy_graphics_item.cpp +++ b/profiler_gui/easy_graphics_item.cpp @@ -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) diff --git a/profiler_gui/easy_graphics_item.h b/profiler_gui/easy_graphics_item.h index 950b1fc..701a9df 100644 --- a/profiler_gui/easy_graphics_item.h +++ b/profiler_gui/easy_graphics_item.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) diff --git a/profiler_gui/easy_graphics_scrollbar.cpp b/profiler_gui/easy_graphics_scrollbar.cpp index cfb44b8..48a9e35 100644 --- a/profiler_gui/easy_graphics_scrollbar.cpp +++ b/profiler_gui/easy_graphics_scrollbar.cpp @@ -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) diff --git a/profiler_gui/easy_graphics_scrollbar.h b/profiler_gui/easy_graphics_scrollbar.h index 62c0bc5..96bc657 100644 --- a/profiler_gui/easy_graphics_scrollbar.h +++ b/profiler_gui/easy_graphics_scrollbar.h @@ -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) diff --git a/profiler_gui/easy_qtimer.cpp b/profiler_gui/easy_qtimer.cpp index cd90b24..5c8e490 100644 --- a/profiler_gui/easy_qtimer.cpp +++ b/profiler_gui/easy_qtimer.cpp @@ -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) diff --git a/profiler_gui/easy_qtimer.h b/profiler_gui/easy_qtimer.h index 3cd74b1..6b12ebd 100644 --- a/profiler_gui/easy_qtimer.h +++ b/profiler_gui/easy_qtimer.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) diff --git a/profiler_gui/globals.cpp b/profiler_gui/globals.cpp index c326e1c..d2913e0 100644 --- a/profiler_gui/globals.cpp +++ b/profiler_gui/globals.cpp @@ -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) diff --git a/profiler_gui/globals.h b/profiler_gui/globals.h index 960306b..76d9f6b 100644 --- a/profiler_gui/globals.h +++ b/profiler_gui/globals.h @@ -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) diff --git a/profiler_gui/globals_qobjects.cpp b/profiler_gui/globals_qobjects.cpp index a7e1838..2dabfec 100644 --- a/profiler_gui/globals_qobjects.cpp +++ b/profiler_gui/globals_qobjects.cpp @@ -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) diff --git a/profiler_gui/globals_qobjects.h b/profiler_gui/globals_qobjects.h index f88b703..f326f9d 100644 --- a/profiler_gui/globals_qobjects.h +++ b/profiler_gui/globals_qobjects.h @@ -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) diff --git a/profiler_gui/graphics_image_item.h b/profiler_gui/graphics_image_item.h index 99a11ea..4f285e7 100644 --- a/profiler_gui/graphics_image_item.h +++ b/profiler_gui/graphics_image_item.h @@ -17,7 +17,7 @@ protected: QRectF m_boundingRect; QImage m_image; - Timer m_boundaryTimer; + Timer m_boundaryTimer; ThreadPoolTask m_worker; QPointF m_mousePos; QImage* m_workerImage; diff --git a/profiler_gui/main.cpp b/profiler_gui/main.cpp index ab09750..66552b4 100644 --- a/profiler_gui/main.cpp +++ b/profiler_gui/main.cpp @@ -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) diff --git a/profiler_gui/main_window.cpp b/profiler_gui/main_window.cpp index 7ce3527..9888b3c 100644 --- a/profiler_gui/main_window.cpp +++ b/profiler_gui/main_window.cpp @@ -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) diff --git a/profiler_gui/main_window.h b/profiler_gui/main_window.h index 18d9835..4d564e6 100644 --- a/profiler_gui/main_window.h +++ b/profiler_gui/main_window.h @@ -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) diff --git a/profiler_gui/resources.rc b/profiler_gui/resources.rc index fdc5adb..e09dbca 100644 --- a/profiler_gui/resources.rc +++ b/profiler_gui/resources.rc @@ -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" diff --git a/profiler_gui/thread_pool.cpp b/profiler_gui/thread_pool.cpp index e6f01c7..cb6c194 100644 --- a/profiler_gui/thread_pool.cpp +++ b/profiler_gui/thread_pool.cpp @@ -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 +#ifdef _MSC_VER +// std::back_inserter is defined in for Visual C++ ... +#include +#endif + ThreadPool& ThreadPool::instance() { static ThreadPool pool; diff --git a/profiler_gui/thread_pool.h b/profiler_gui/thread_pool.h index 40dae0b..00c38e1 100644 --- a/profiler_gui/thread_pool.h +++ b/profiler_gui/thread_pool.h @@ -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 diff --git a/profiler_gui/thread_pool_task.cpp b/profiler_gui/thread_pool_task.cpp index 5d8e33e..f1ce45e 100644 --- a/profiler_gui/thread_pool_task.cpp +++ b/profiler_gui/thread_pool_task.cpp @@ -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" diff --git a/profiler_gui/thread_pool_task.h b/profiler_gui/thread_pool_task.h index e75d5d5..42ca13d 100644 --- a/profiler_gui/thread_pool_task.h +++ b/profiler_gui/thread_pool_task.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 diff --git a/profiler_gui/tree_widget_item.cpp b/profiler_gui/tree_widget_item.cpp index 585f584..de96d96 100644 --- a/profiler_gui/tree_widget_item.cpp +++ b/profiler_gui/tree_widget_item.cpp @@ -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) diff --git a/profiler_gui/tree_widget_item.h b/profiler_gui/tree_widget_item.h index c56b4ab..d224d2b 100644 --- a/profiler_gui/tree_widget_item.h +++ b/profiler_gui/tree_widget_item.h @@ -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) diff --git a/profiler_gui/tree_widget_loader.cpp b/profiler_gui/tree_widget_loader.cpp index 6e6d5ea..23252e0 100644 --- a/profiler_gui/tree_widget_loader.cpp +++ b/profiler_gui/tree_widget_loader.cpp @@ -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) diff --git a/profiler_gui/tree_widget_loader.h b/profiler_gui/tree_widget_loader.h index d11d4b8..46dea77 100644 --- a/profiler_gui/tree_widget_loader.h +++ b/profiler_gui/tree_widget_loader.h @@ -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) diff --git a/sample/main_clock.cpp b/sample/main_clock.cpp index 95fa008..3abe993 100644 --- a/sample/main_clock.cpp +++ b/sample/main_clock.cpp @@ -12,7 +12,7 @@ #include -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; }