0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-28 01:04:41 +08:00
Victor Zarubkin 4f0fabdfd6 (profiler Reader) Added block_index field and replaced pointers SerilizedBlock* to block indexes;
(profiler GUI) Added plain vector of ProfBlocks (additional information for gui) for fast access;
(ProfGraphicsView) Removed unnecessary methods; small refactoring;
(ProfTreeWidget) Removed unnecessary map of tree items;
(ProfGraphicsScrollbar) Added colorizing of minimap (green = low duration, red = long duration);
2016-08-04 22:38:45 +03:00

91 lines
2.7 KiB
C++

/************************************************************************
* file name : globals.h
* ----------------- :
* creation time : 2016/08/03
* copyright : (c) 2016 Victor Zarubkin
* author : Victor Zarubkin
* email : v.s.zarubkin@gmail.com
* ----------------- :
* description : The file contains declaration of global constants and variables for profiler gui.
* ----------------- :
* change log : * 2016/08/03 Victor Zarubkin: initial commit.
* :
* : *
* ----------------- :
* license : TODO: add license text
************************************************************************/
#ifndef EASY_PROFILER__GUI_GLOBALS_H
#define EASY_PROFILER__GUI_GLOBALS_H
#include <string>
#include <QObject>
#include "common_types.h"
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class ProfGraphicsItem;
class ProfTreeWidgetItem;
//////////////////////////////////////////////////////////////////////////
namespace profiler_gui {
//////////////////////////////////////////////////////////////////////////
class ProfGlobalSignals final : public QObject
{
Q_OBJECT
public:
ProfGlobalSignals();
virtual ~ProfGlobalSignals();
signals:
void selectedThreadChanged(::profiler::thread_id_t _id);
void selectedBlockChanged(unsigned int _block_index);
};
//////////////////////////////////////////////////////////////////////////
struct ProfBlock final
{
ProfGraphicsItem* graphics_item;
ProfTreeWidgetItem* tree_item;
unsigned short graphics_item_level;
unsigned int graphics_item_index;
};
typedef ::std::vector<ProfBlock> ProfBlocks;
//////////////////////////////////////////////////////////////////////////
struct ProfGlobals final
{
static ProfGlobals& instance();
ProfGlobalSignals events;
::profiler::thread_blocks_tree_t profiler_blocks;
ProfBlocks gui_blocks;
::profiler::thread_id_t selected_thread;
unsigned int selected_block;
private:
ProfGlobals();
};
static ProfGlobals& EASY_GLOBALS = ProfGlobals::instance();
//////////////////////////////////////////////////////////////////////////
} // END of namespace profiler_gui.
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
#endif // EASY_PROFILER__GUI_GLOBALS_H