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

Rename directory profiler to easy

This commit is contained in:
Sergey Yagovtsev 2016-09-29 23:29:57 +03:00
parent eca7061fd0
commit 76defe2372
29 changed files with 142 additions and 135 deletions

View File

@ -19,7 +19,7 @@ along with this program.If not, see <http://www.gnu.org/licenses/>.
#define EASY________SOCKET_________H
#include <stdint.h>
#include "profiler/profiler.h"
#include "easy/profiler.h"
#ifndef _WIN32
#include <sys/types.h>
#include <sys/socket.h>

View File

@ -19,7 +19,7 @@ along with this program.If not, see <http://www.gnu.org/licenses/>.
#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 ...

View File

@ -32,8 +32,8 @@
#define EASY_PROFILER__AUX__H_______
#include <stdint.h>
#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 <type_traits>
#include <string>
# define EASY_STRINGIFY(a) #a
# define EASY_STRINGIFICATION(a) EASY_STRINGIFY(a)
@ -73,11 +74,19 @@ namespace profiler {
template <const bool IS_REF> 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 <class T>
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<true> EASY_FINAL {
static const char* runtime_name(const char*) { return ""; }
static const char* runtime_name(const std::string& name) { return name.c_str(); }
template <class T>
static const char* compiletime_name(const T&, const char* autoGeneratedName) { return autoGeneratedName; }
static const char* compiletime_name(const char* name, const char*) { return name; }
};

View File

@ -25,8 +25,8 @@ along with this program.If not, see <http://www.gnu.org/licenses/>.
#include <vector>
#include <string>
#include <atomic>
#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)

View File

@ -19,7 +19,7 @@ along with this program.If not, see <http://www.gnu.org/licenses/>.
#ifndef EASY_PROFILER_SERIALIZED_BLOCK__H_______
#define EASY_PROFILER_SERIALIZED_BLOCK__H_______
#include "profiler/profiler.h"
#include "easy/profiler.h"
namespace profiler {

View File

@ -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

View File

@ -46,7 +46,7 @@
#include <QPoint>
#include <QRectF>
#include <QTimer>
#include "profiler/reader.h"
#include "easy/reader.h"
#include "common_types.h"
//////////////////////////////////////////////////////////////////////////

View File

@ -42,7 +42,7 @@
#include <QTreeWidget>
#include <QTimer>
#include "tree_widget_loader.h"
#include "profiler/reader.h"
#include "easy/reader.h"
//////////////////////////////////////////////////////////////////////////

View File

@ -38,7 +38,7 @@
#include <QRgb>
#include <QString>
#include <QFont>
#include "profiler/reader.h"
#include "easy/reader.h"
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////

View File

@ -35,7 +35,7 @@
#include <QTreeWidget>
#include <QString>
#include <vector>
#include "profiler/profiler.h"
#include "easy/profiler.h"
//////////////////////////////////////////////////////////////////////////

View File

@ -36,7 +36,7 @@
#include <QGraphicsItem>
#include <QRectF>
#include <QString>
#include "profiler/reader.h"
#include "easy/reader.h"
#include "common_types.h"
//////////////////////////////////////////////////////////////////////////

View File

@ -32,7 +32,7 @@
#define EASY__GLOBALS_QOBJECTS_H___
#include <QObject>
#include "profiler/profiler.h"
#include "easy/profiler.h"
namespace profiler_gui {

View File

@ -30,7 +30,7 @@
//#include <QFileSystemModel>
//#include "treemodel.h"
#include "main_window.h"
#include "profiler/reader.h"
#include "easy/reader.h"
//#ifdef _WIN32

View File

@ -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<const ::profiler::net::EasyProfilerStatus*>(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()

View File

@ -38,8 +38,8 @@
#include <QMainWindow>
#include <QTimer>
#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; ///<

View File

@ -35,7 +35,7 @@
#include <stdlib.h>
#include <QTreeWidget>
#include "profiler/reader.h"
#include "easy/reader.h"
#include "common_types.h"
//////////////////////////////////////////////////////////////////////////

View File

@ -37,7 +37,7 @@
#include <vector>
#include <thread>
#include <atomic>
#include "profiler/reader.h"
#include "easy/reader.h"
#include "common_types.h"
//////////////////////////////////////////////////////////////////////////

View File

@ -1,5 +1,5 @@
#include "profiler/profiler.h"
#include "profiler/reader.h"
#include "easy/profiler.h"
#include "easy/reader.h"
#include <fstream>
#include <list>
#include <iostream>

View File

@ -1,11 +1,11 @@
//#define FULL_DISABLE_PROFILER
#include "profiler/profiler.h"
#include "easy/profiler.h"
#include <chrono>
#include <thread>
#include <vector>
#include <iostream>
#include <condition_variable>
#include "profiler/reader.h"
#include "easy/reader.h"
#include <cstdlib>
#include <math.h>

View File

@ -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

View File

@ -19,7 +19,7 @@ along with this program.If not, see <http://www.gnu.org/licenses/>.
#ifndef EASY_______CURRENT_TIME_H_____
#define EASY_______CURRENT_TIME_H_____
#include "profiler/profiler.h"
#include "easy/profiler.h"
#ifdef _WIN32
#include <Windows.h>

View File

@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
along with this program.If not, see <http://www.gnu.org/licenses/>.
**/
#include "profiler/easy_socket.h"
#include "easy/easy_socket.h"
#include <string.h>
#include <thread>

View File

@ -36,7 +36,7 @@
#include <memory.h>
#include <chrono>
#include <unordered_map>
#include "profiler/profiler.h"
#include "easy/profiler.h"
#include "profile_manager.h"
#include "current_time.h"

View File

@ -27,9 +27,9 @@
#include <algorithm>
#include <fstream>
#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"

View File

@ -19,8 +19,8 @@ along with this program.If not, see <http://www.gnu.org/licenses/>.
#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"

View File

@ -42,7 +42,7 @@
* : along with this program.If not, see <http://www.gnu.org/licenses/>.
************************************************************************/
#include "profiler/reader.h"
#include "easy/reader.h"
#include "hashed_cstr.h"
#include <fstream>
#include <sstream>