diff --git a/include/profiler/profiler.h b/include/profiler/profiler.h index c43870c..7ab3b99 100644 --- a/include/profiler/profiler.h +++ b/include/profiler/profiler.h @@ -383,6 +383,7 @@ namespace profiler { public: explicit BlockDescRef(const BaseBlockDescriptor& _desc) : m_desc(_desc) { } + explicit BlockDescRef(const BaseBlockDescriptor* _desc) : m_desc(*_desc) { } inline operator const BaseBlockDescriptor& () const { return m_desc; } ~BlockDescRef(); @@ -407,7 +408,7 @@ namespace profiler { \ingroup profiler */ - PROFILER_API const BaseBlockDescriptor& registerDescription(bool _enabled, const char* _autogenUniqueId, const char* _compiletimeName, const char* _filename, int _line, block_type_t _block_type, color_t _color); + PROFILER_API const BaseBlockDescriptor* registerDescription(bool _enabled, const char* _autogenUniqueId, const char* _compiletimeName, const char* _filename, int _line, block_type_t _block_type, color_t _color); /** Stores event in the blocks list. diff --git a/profiler_gui/blocks_graphics_view.cpp b/profiler_gui/blocks_graphics_view.cpp index c3420d8..317ec51 100644 --- a/profiler_gui/blocks_graphics_view.cpp +++ b/profiler_gui/blocks_graphics_view.cpp @@ -816,7 +816,6 @@ const ::profiler_gui::EasyBlock* EasyGraphicsItem::intersectEvent(const QPointF& } const auto sceneView = view(); - const auto currentScale = view()->scale(); auto firstSync = ::std::lower_bound(m_pRoot->sync.begin(), m_pRoot->sync.end(), _pos.x(), [&sceneView](::profiler::block_index_t _index, qreal _value) { return sceneView->time2position(blocksTree(_index).node->begin()) < _value; diff --git a/src/profile_manager.cpp b/src/profile_manager.cpp index c91cc30..7b734fd 100644 --- a/src/profile_manager.cpp +++ b/src/profile_manager.cpp @@ -47,7 +47,7 @@ extern timestamp_t getCurrentTime(); extern "C" { - PROFILER_API const BaseBlockDescriptor& registerDescription(bool _enabled, const char* _autogenUniqueId, const char* _name, const char* _filename, int _line, block_type_t _block_type, color_t _color) + PROFILER_API const BaseBlockDescriptor* registerDescription(bool _enabled, const char* _autogenUniqueId, const char* _name, const char* _filename, int _line, block_type_t _block_type, color_t _color) { return MANAGER.addBlockDescriptor(_enabled, _autogenUniqueId, _name, _filename, _line, _block_type, _color); } @@ -153,8 +153,8 @@ void ThreadStorage::storeBlock(const profiler::Block& block) auto size = static_cast(sizeof(BaseBlockData) + name_length + 1); #if EASY_MEASURE_STORAGE_EXPAND != 0 - const bool expanded = desc.enabled() && blocks.closedList.need_expand(size); - profiler::Block b(0ULL, desc.id(), ""); + const bool expanded = desc->enabled() && blocks.closedList.need_expand(size); + profiler::Block b(0ULL, desc->id(), ""); if (expanded) b.start(); #endif diff --git a/src/profile_manager.h b/src/profile_manager.h index 4e013f7..c4d2a49 100644 --- a/src/profile_manager.h +++ b/src/profile_manager.h @@ -342,7 +342,7 @@ public: ~ProfileManager(); template - const profiler::BaseBlockDescriptor& addBlockDescriptor(bool _enabledByDefault, const char* _autogenUniqueId, TArgs ... _args) + const profiler::BaseBlockDescriptor* addBlockDescriptor(bool _enabledByDefault, const char* _autogenUniqueId, TArgs ... _args) { auto desc = new profiler::BlockDescriptor(m_usedMemorySize, _enabledByDefault, _args...); @@ -362,7 +362,7 @@ public: desc->m_pEnable = &m_blocksEnableStatus.emplace(key, desc->enabled()).first->second; } - return *desc; + return desc; } void storeBlock(const profiler::BaseBlockDescriptor& _desc, const char* _runtimeName); diff --git a/src/reader.cpp b/src/reader.cpp index 0830c6b..7740c12 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -342,7 +342,6 @@ extern "C" ::profiler::block_index_t fillTreesFromFile(::std::atomic& progr auto& per_parent_statistics = parent_statistics[thread_id]; auto& per_thread_statistics = thread_statistics[thread_id]; - auto descriptor = descriptors[baseData->id()]; if (*tree.node->name() != 0) {