diff --git a/include/profiler/easy_compiler_support.h b/include/easy/easy_compiler_support.h
similarity index 100%
rename from include/profiler/easy_compiler_support.h
rename to include/easy/easy_compiler_support.h
diff --git a/include/profiler/easy_net.h b/include/easy/easy_net.h
similarity index 100%
rename from include/profiler/easy_net.h
rename to include/easy/easy_net.h
diff --git a/include/profiler/easy_socket.h b/include/easy/easy_socket.h
similarity index 98%
rename from include/profiler/easy_socket.h
rename to include/easy/easy_socket.h
index 865f969..a3c4bcb 100644
--- a/include/profiler/easy_socket.h
+++ b/include/easy/easy_socket.h
@@ -19,7 +19,7 @@ along with this program.If not, see .
#define EASY________SOCKET_________H
#include
-#include "profiler/profiler.h"
+#include "easy/profiler.h"
#ifndef _WIN32
#include
#include
diff --git a/include/profiler/profiler.h b/include/easy/profiler.h
similarity index 99%
rename from include/profiler/profiler.h
rename to include/easy/profiler.h
index f6aa7c3..613ccd5 100644
--- a/include/profiler/profiler.h
+++ b/include/easy/profiler.h
@@ -19,7 +19,7 @@ along with this program.If not, see .
#ifndef EASY_PROFILER____H_______
#define EASY_PROFILER____H_______
-#include "profiler/profiler_aux.h"
+#include "easy/profiler_aux.h"
#if defined ( __clang__ )
# pragma clang diagnostic push
@@ -44,7 +44,7 @@ namespace profiler {
/** Macro for beginning of a block with custom name and color.
\code
- #include "profiler/profiler.h"
+ #include "easy/profiler.h"
void foo()
{
// some code ...
@@ -83,7 +83,7 @@ Block will be automatically completed by destructor.
/** Macro for beginning of a block with function name and custom color.
\code
- #include "profiler/profiler.h"
+ #include "easy/profiler.h"
void foo(){
EASY_FUNCTION(); // Block with name="foo" and default color
//some code...
@@ -113,7 +113,7 @@ Name of the block automatically created with function name.
/** Macro for completion of last opened block.
\code
-#include "profiler/profiler.h"
+#include "easy/profiler.h"
int foo()
{
// some code ...
diff --git a/include/profiler/profiler_aux.h b/include/easy/profiler_aux.h
similarity index 91%
rename from include/profiler/profiler_aux.h
rename to include/easy/profiler_aux.h
index 376251a..bbdafe2 100644
--- a/include/profiler/profiler_aux.h
+++ b/include/easy/profiler_aux.h
@@ -32,8 +32,8 @@
#define EASY_PROFILER__AUX__H_______
#include
-#include "profiler/easy_compiler_support.h"
-#include "profiler/profiler_colors.h"
+#include "easy/easy_compiler_support.h"
+#include "easy/profiler_colors.h"
//////////////////////////////////////////////////////////////////////////
@@ -61,6 +61,7 @@ namespace profiler {
#ifndef FULL_DISABLE_PROFILER
#include
+#include
# define EASY_STRINGIFY(a) #a
# define EASY_STRINGIFICATION(a) EASY_STRINGIFY(a)
@@ -73,11 +74,19 @@ namespace profiler {
template struct NameSwitch EASY_FINAL {
static const char* runtime_name(const char* name) { return name; }
+ static const char* runtime_name(const std::string& name) { return name.c_str(); }
+
+ template
+ static const char* compiletime_name(const T&, const char* autoGeneratedName) { return autoGeneratedName; }
static const char* compiletime_name(const char*, const char* autoGeneratedName) { return autoGeneratedName; }
};
template <> struct NameSwitch EASY_FINAL {
static const char* runtime_name(const char*) { return ""; }
+ static const char* runtime_name(const std::string& name) { return name.c_str(); }
+
+ template
+ static const char* compiletime_name(const T&, const char* autoGeneratedName) { return autoGeneratedName; }
static const char* compiletime_name(const char* name, const char*) { return name; }
};
diff --git a/include/profiler/profiler_colors.h b/include/easy/profiler_colors.h
similarity index 100%
rename from include/profiler/profiler_colors.h
rename to include/easy/profiler_colors.h
diff --git a/include/profiler/reader.h b/include/easy/reader.h
similarity index 99%
rename from include/profiler/reader.h
rename to include/easy/reader.h
index ce65e2f..d943a9f 100644
--- a/include/profiler/reader.h
+++ b/include/easy/reader.h
@@ -25,8 +25,8 @@ along with this program.If not, see .
#include
#include
#include
-#include "profiler/profiler.h"
-#include "profiler/serialized_block.h"
+#include "easy/profiler.h"
+#include "easy/serialized_block.h"
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -82,8 +82,8 @@ namespace profiler {
children_t children; ///< List of children blocks. May be empty.
::profiler::SerializedBlock* node; ///< Pointer to serilized data (type, name, begin, end etc.)
- ::profiler::BlockStatistics* per_parent_stats; ///< Pointer to statistics for this block within the parent (may be nullptr for top-level blocks)
- ::profiler::BlockStatistics* per_frame_stats; ///< Pointer to statistics for this block within the frame (may be nullptr for top-level blocks)
+ ::profiler::BlockStatistics* per_parent_stats; ///< Pointer to statistics for this block within the parent (may be nullptr for top-level blocks)
+ ::profiler::BlockStatistics* per_frame_stats; ///< Pointer to statistics for this block within the frame (may be nullptr for top-level blocks)
::profiler::BlockStatistics* per_thread_stats; ///< Pointer to statistics for this block within the bounds of all frames per current thread
uint16_t depth; ///< Maximum number of sublevels (maximum children depth)
diff --git a/include/profiler/serialized_block.h b/include/easy/serialized_block.h
similarity index 98%
rename from include/profiler/serialized_block.h
rename to include/easy/serialized_block.h
index ce0e6d4..7a9c6ab 100644
--- a/include/profiler/serialized_block.h
+++ b/include/easy/serialized_block.h
@@ -19,7 +19,7 @@ along with this program.If not, see .
#ifndef EASY_PROFILER_SERIALIZED_BLOCK__H_______
#define EASY_PROFILER_SERIALIZED_BLOCK__H_______
-#include "profiler/profiler.h"
+#include "easy/profiler.h"
namespace profiler {
diff --git a/profiler_gui/CMakeLists.txt b/profiler_gui/CMakeLists.txt
index a8f0947..b77084e 100644
--- a/profiler_gui/CMakeLists.txt
+++ b/profiler_gui/CMakeLists.txt
@@ -11,8 +11,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Network REQUIRED)
-include_directories(${ROOT}/3rdparty/nanomsg/src)
-
add_executable(${PROJECT_NAME}
main.cpp
blocks_graphics_view.h
diff --git a/profiler_gui/blocks_graphics_view.h b/profiler_gui/blocks_graphics_view.h
index fb32806..bbaf7ee 100644
--- a/profiler_gui/blocks_graphics_view.h
+++ b/profiler_gui/blocks_graphics_view.h
@@ -46,7 +46,7 @@
#include
#include
#include
-#include "profiler/reader.h"
+#include "easy/reader.h"
#include "common_types.h"
//////////////////////////////////////////////////////////////////////////
diff --git a/profiler_gui/blocks_tree_widget.h b/profiler_gui/blocks_tree_widget.h
index 15c68db..1068431 100644
--- a/profiler_gui/blocks_tree_widget.h
+++ b/profiler_gui/blocks_tree_widget.h
@@ -42,7 +42,7 @@
#include
#include
#include "tree_widget_loader.h"
-#include "profiler/reader.h"
+#include "easy/reader.h"
//////////////////////////////////////////////////////////////////////////
diff --git a/profiler_gui/common_types.h b/profiler_gui/common_types.h
index 80ce6a2..18f1596 100644
--- a/profiler_gui/common_types.h
+++ b/profiler_gui/common_types.h
@@ -38,7 +38,7 @@
#include
#include
#include
-#include "profiler/reader.h"
+#include "easy/reader.h"
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
diff --git a/profiler_gui/descriptors_tree_widget.h b/profiler_gui/descriptors_tree_widget.h
index 780662c..57ae124 100644
--- a/profiler_gui/descriptors_tree_widget.h
+++ b/profiler_gui/descriptors_tree_widget.h
@@ -35,7 +35,7 @@
#include
#include
#include
-#include "profiler/profiler.h"
+#include "easy/profiler.h"
//////////////////////////////////////////////////////////////////////////
diff --git a/profiler_gui/easy_graphics_item.h b/profiler_gui/easy_graphics_item.h
index 958ee72..5a6e918 100644
--- a/profiler_gui/easy_graphics_item.h
+++ b/profiler_gui/easy_graphics_item.h
@@ -36,7 +36,7 @@
#include
#include
#include
-#include "profiler/reader.h"
+#include "easy/reader.h"
#include "common_types.h"
//////////////////////////////////////////////////////////////////////////
diff --git a/profiler_gui/globals_qobjects.h b/profiler_gui/globals_qobjects.h
index 1addf26..d448d8b 100644
--- a/profiler_gui/globals_qobjects.h
+++ b/profiler_gui/globals_qobjects.h
@@ -32,7 +32,7 @@
#define EASY__GLOBALS_QOBJECTS_H___
#include
-#include "profiler/profiler.h"
+#include "easy/profiler.h"
namespace profiler_gui {
diff --git a/profiler_gui/main.cpp b/profiler_gui/main.cpp
index 43f77b7..9cf8ec9 100644
--- a/profiler_gui/main.cpp
+++ b/profiler_gui/main.cpp
@@ -30,7 +30,7 @@
//#include
//#include "treemodel.h"
#include "main_window.h"
-#include "profiler/reader.h"
+#include "easy/reader.h"
//#ifdef _WIN32
diff --git a/profiler_gui/main_window.cpp b/profiler_gui/main_window.cpp
index c57bd31..311583c 100644
--- a/profiler_gui/main_window.cpp
+++ b/profiler_gui/main_window.cpp
@@ -64,7 +64,7 @@
#include "blocks_graphics_view.h"
#include "descriptors_tree_widget.h"
#include "globals.h"
-#include "profiler/easy_net.h"
+#include "easy/easy_net.h"
#ifdef max
#undef max
@@ -658,7 +658,7 @@ void EasyMainWindow::onListenerDialogClose(int)
break;
}
- default:
+ default:
return;
}
@@ -1048,60 +1048,60 @@ void EasyMainWindow::onBlockStatusChange(::profiler::block_id_t _id, ::profiler:
//////////////////////////////////////////////////////////////////////////
-EasySocketListener::EasySocketListener() : m_receivedSize(0), m_regime(LISTENER_IDLE)
-{
- m_bInterrupt = ATOMIC_VAR_INIT(false);
- m_bConnected = ATOMIC_VAR_INIT(false);
-}
-
-EasySocketListener::~EasySocketListener()
-{
- m_bInterrupt.store(true, ::std::memory_order_release);
- if (m_thread.joinable())
- m_thread.join();
-}
-
-bool EasySocketListener::connected() const
-{
- return m_bConnected.load(::std::memory_order_acquire);
-}
-
-EasyListenerRegime EasySocketListener::regime() const
-{
- return m_regime;
-}
-
-uint64_t EasySocketListener::size() const
-{
- return m_receivedSize;
-}
-
-::std::stringstream& EasySocketListener::data()
-{
- return m_receivedData;
-}
-
-void EasySocketListener::clearData()
-{
+EasySocketListener::EasySocketListener() : m_receivedSize(0), m_regime(LISTENER_IDLE)
+{
+ m_bInterrupt = ATOMIC_VAR_INIT(false);
+ m_bConnected = ATOMIC_VAR_INIT(false);
+}
+
+EasySocketListener::~EasySocketListener()
+{
+ m_bInterrupt.store(true, ::std::memory_order_release);
+ if (m_thread.joinable())
+ m_thread.join();
+}
+
+bool EasySocketListener::connected() const
+{
+ return m_bConnected.load(::std::memory_order_acquire);
+}
+
+EasyListenerRegime EasySocketListener::regime() const
+{
+ return m_regime;
+}
+
+uint64_t EasySocketListener::size() const
+{
+ return m_receivedSize;
+}
+
+::std::stringstream& EasySocketListener::data()
+{
+ return m_receivedData;
+}
+
+void EasySocketListener::clearData()
+{
decltype(m_receivedData) dummy;
- dummy.swap(m_receivedData);
- m_receivedSize = 0;
-}
-
-bool EasySocketListener::connect(const char* _ipaddress, uint16_t _port, profiler::net::EasyProfilerStatus& _reply)
-{
- if (connected())
- return true;
-
+ dummy.swap(m_receivedData);
+ m_receivedSize = 0;
+}
+
+bool EasySocketListener::connect(const char* _ipaddress, uint16_t _port, profiler::net::EasyProfilerStatus& _reply)
+{
+ if (connected())
+ return true;
+
m_easySocket.flush();
m_easySocket.init();
int res = m_easySocket.setAddress(_ipaddress, _port);
- res = m_easySocket.connect();
-
- const bool isConnected = res == 0;
- if (isConnected)
- {
- static const size_t buffer_size = sizeof(profiler::net::EasyProfilerStatus) << 1;
+ res = m_easySocket.connect();
+
+ const bool isConnected = res == 0;
+ if (isConnected)
+ {
+ static const size_t buffer_size = sizeof(profiler::net::EasyProfilerStatus) << 1;
char buffer[buffer_size] = {};
int bytes = 0;
@@ -1122,7 +1122,7 @@ bool EasySocketListener::connect(const char* _ipaddress, uint16_t _port, profile
if (bytes == 0)
{
- m_bConnected.store(isConnected, ::std::memory_order_release);
+ m_bConnected.store(isConnected, ::std::memory_order_release);
return isConnected;
}
@@ -1144,50 +1144,50 @@ bool EasySocketListener::connect(const char* _ipaddress, uint16_t _port, profile
auto message = reinterpret_cast(buffer);
if (message->isEasyNetMessage() && message->type == profiler::net::MESSAGE_TYPE_ACCEPTED_CONNECTION)
_reply = *message;
- }
-
- m_bConnected.store(isConnected, ::std::memory_order_release);
- return isConnected;
-}
-
-void EasySocketListener::startCapture()
-{
- clearData();
-
+ }
+
+ m_bConnected.store(isConnected, ::std::memory_order_release);
+ return isConnected;
+}
+
+void EasySocketListener::startCapture()
+{
+ clearData();
+
profiler::net::Message request(profiler::net::MESSAGE_TYPE_REQUEST_START_CAPTURE);
- m_easySocket.send(&request, sizeof(request));
-
- m_regime = LISTENER_CAPTURE;
+ m_easySocket.send(&request, sizeof(request));
+
+ m_regime = LISTENER_CAPTURE;
m_thread = ::std::move(::std::thread(&EasySocketListener::listenCapture, this));
-}
-
-void EasySocketListener::stopCapture()
-{
- if (!m_thread.joinable() || m_regime != LISTENER_CAPTURE)
- return;
-
+}
+
+void EasySocketListener::stopCapture()
+{
+ if (!m_thread.joinable() || m_regime != LISTENER_CAPTURE)
+ return;
+
profiler::net::Message request(profiler::net::MESSAGE_TYPE_REQUEST_STOP_CAPTURE);
m_easySocket.send(&request, sizeof(request));
- m_thread.join();
-
- m_regime = LISTENER_IDLE;
-}
-
-void EasySocketListener::requestBlocksDescription()
-{
- clearData();
-
+ m_thread.join();
+
+ m_regime = LISTENER_IDLE;
+}
+
+void EasySocketListener::requestBlocksDescription()
+{
+ clearData();
+
profiler::net::Message request(profiler::net::MESSAGE_TYPE_REQUEST_BLOCKS_DESCRIPTION);
- m_easySocket.send(&request, sizeof(request));
-
- m_regime = LISTENER_DESCRIBE;
- listenDescription();
- m_regime = LISTENER_IDLE;
-}
-
-//////////////////////////////////////////////////////////////////////////
-
+ m_easySocket.send(&request, sizeof(request));
+
+ m_regime = LISTENER_DESCRIBE;
+ listenDescription();
+ m_regime = LISTENER_IDLE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+
void EasySocketListener::listenCapture()
{
// TODO: Merge functions listenCapture() and listenDescription()
diff --git a/profiler_gui/main_window.h b/profiler_gui/main_window.h
index a38dd10..7e5c26e 100644
--- a/profiler_gui/main_window.h
+++ b/profiler_gui/main_window.h
@@ -38,8 +38,8 @@
#include
#include
-#include "profiler/easy_socket.h"
-#include "profiler/reader.h"
+#include "easy/easy_socket.h"
+#include "easy/reader.h"
#ifdef max
#undef max
@@ -110,8 +110,8 @@ class EasySocketListener Q_DECL_FINAL
{
EasySocket m_easySocket; ///<
::std::stringstream m_receivedData; ///<
- ::std::thread m_thread; ///<
- uint64_t m_receivedSize; ///<
+ ::std::thread m_thread; ///<
+ uint64_t m_receivedSize; ///<
::std::atomic_bool m_bInterrupt; ///<
::std::atomic_bool m_bConnected; ///<
EasyListenerRegime m_regime; ///<
diff --git a/profiler_gui/tree_widget_item.h b/profiler_gui/tree_widget_item.h
index 182eca8..bd94464 100644
--- a/profiler_gui/tree_widget_item.h
+++ b/profiler_gui/tree_widget_item.h
@@ -35,7 +35,7 @@
#include
#include
-#include "profiler/reader.h"
+#include "easy/reader.h"
#include "common_types.h"
//////////////////////////////////////////////////////////////////////////
diff --git a/profiler_gui/tree_widget_loader.h b/profiler_gui/tree_widget_loader.h
index 718392f..f3b453b 100644
--- a/profiler_gui/tree_widget_loader.h
+++ b/profiler_gui/tree_widget_loader.h
@@ -37,7 +37,7 @@
#include
#include
#include
-#include "profiler/reader.h"
+#include "easy/reader.h"
#include "common_types.h"
//////////////////////////////////////////////////////////////////////////
diff --git a/reader/main.cpp b/reader/main.cpp
index df490ee..fa04d06 100644
--- a/reader/main.cpp
+++ b/reader/main.cpp
@@ -1,5 +1,5 @@
-#include "profiler/profiler.h"
-#include "profiler/reader.h"
+#include "easy/profiler.h"
+#include "easy/reader.h"
#include
#include
#include
diff --git a/sample/main.cpp b/sample/main.cpp
index c8a6f64..d9bd21d 100644
--- a/sample/main.cpp
+++ b/sample/main.cpp
@@ -1,11 +1,11 @@
//#define FULL_DISABLE_PROFILER
-#include "profiler/profiler.h"
+#include "easy/profiler.h"
#include
#include
#include
#include
#include
-#include "profiler/reader.h"
+#include "easy/reader.h"
#include
#include
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 87be249..51fa9e1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -9,10 +9,10 @@ set(CPP_FILES
)
set(H_FILES
- ${ROOT}/include/profiler/profiler.h
- ${ROOT}/include/profiler/reader.h
- ${ROOT}/include/profiler/easy_net.h
- ${ROOT}/include/profiler/easy_socket.h
+ ${ROOT}/include/easy/profiler.h
+ ${ROOT}/include/easy/reader.h
+ ${ROOT}/include/easy/easy_net.h
+ ${ROOT}/include/easy/easy_socket.h
profile_manager.h
spin_lock.h
event_trace_win.h
diff --git a/src/current_time.h b/src/current_time.h
index 718fb36..dee4ba5 100644
--- a/src/current_time.h
+++ b/src/current_time.h
@@ -19,7 +19,7 @@ along with this program.If not, see .
#ifndef EASY_______CURRENT_TIME_H_____
#define EASY_______CURRENT_TIME_H_____
-#include "profiler/profiler.h"
+#include "easy/profiler.h"
#ifdef _WIN32
#include
diff --git a/src/easy_socket.cpp b/src/easy_socket.cpp
index 05fafbe..d7cb56f 100644
--- a/src/easy_socket.cpp
+++ b/src/easy_socket.cpp
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
along with this program.If not, see .
**/
-#include "profiler/easy_socket.h"
+#include "easy/easy_socket.h"
#include
#include
diff --git a/src/event_trace_win.cpp b/src/event_trace_win.cpp
index 7d9277a..4b6a00c 100644
--- a/src/event_trace_win.cpp
+++ b/src/event_trace_win.cpp
@@ -36,7 +36,7 @@
#include
#include
#include
-#include "profiler/profiler.h"
+#include "easy/profiler.h"
#include "profile_manager.h"
#include "current_time.h"
diff --git a/src/profile_manager.cpp b/src/profile_manager.cpp
index 1bbe56d..542012c 100644
--- a/src/profile_manager.cpp
+++ b/src/profile_manager.cpp
@@ -27,9 +27,9 @@
#include
#include
#include "profile_manager.h"
-#include "profiler/serialized_block.h"
-#include "profiler/easy_net.h"
-#include "profiler/easy_socket.h"
+#include "easy/serialized_block.h"
+#include "easy/easy_net.h"
+#include "easy/easy_socket.h"
#include "event_trace_win.h"
#include "current_time.h"
diff --git a/src/profile_manager.h b/src/profile_manager.h
index 6fb4837..1226597 100644
--- a/src/profile_manager.h
+++ b/src/profile_manager.h
@@ -19,8 +19,8 @@ along with this program.If not, see .
#ifndef EASY_PROFILER____MANAGER____H______
#define EASY_PROFILER____MANAGER____H______
-#include "profiler/profiler.h"
-#include "profiler/easy_socket.h"
+#include "easy/profiler.h"
+#include "easy/easy_socket.h"
#include "spin_lock.h"
#include "outstream.h"
#include "hashed_cstr.h"
diff --git a/src/reader.cpp b/src/reader.cpp
index ebae752..69120b4 100644
--- a/src/reader.cpp
+++ b/src/reader.cpp
@@ -42,7 +42,7 @@
* : along with this program.If not, see .
************************************************************************/
-#include "profiler/reader.h"
+#include "easy/reader.h"
#include "hashed_cstr.h"
#include
#include