0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-27 08:41:02 +08:00

update #20 - first manual version of histogram boundary control: Shift + Mouse Wheel == adjust top boundary (max duration); Ctrl + Mouse Wheel == adjust bottom boundary (min duration)

This commit is contained in:
Victor Zarubkin 2017-03-07 00:29:34 +03:00
parent 973c03f5f5
commit 648930eba8
5 changed files with 426 additions and 233 deletions

File diff suppressed because it is too large Load Diff

View File

@ -126,18 +126,21 @@ public:
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
class EasyHystogramItem : public QGraphicsItem class EasyHistogramItem : public QGraphicsItem
{ {
typedef QGraphicsItem Parent; typedef QGraphicsItem Parent;
typedef EasyHystogramItem This; typedef EasyHistogramItem This;
enum HystRegime : uint8_t { Hyst_Pointer, Hyst_Id }; enum HystRegime : uint8_t { Hyst_Pointer, Hyst_Id };
QRectF m_boundingRect; QRectF m_boundingRect;
qreal m_topDuration;
qreal m_bottomDuration;
qreal m_maxDuration; qreal m_maxDuration;
qreal m_minDuration; qreal m_minDuration;
QString m_maxDurationStr; qreal m_mouseY;
QString m_minDurationStr; QString m_topDurationStr;
QString m_bottomDurationStr;
QString m_threadName; QString m_threadName;
::profiler::BlocksTree::children_t m_selectedBlocks; ::profiler::BlocksTree::children_t m_selectedBlocks;
QImage m_mainImage; QImage m_mainImage;
@ -154,14 +157,14 @@ class EasyHystogramItem : public QGraphicsItem
int m_timeouts; int m_timeouts;
::profiler_gui::TimeUnits m_timeUnits; ::profiler_gui::TimeUnits m_timeUnits;
HystRegime m_regime; HystRegime m_regime;
bool m_bUpdatingImage; bool m_bPermitImageUpdate; ///< Is false when m_workerThread is parsing input dataset (when setSource(_block_id) is called)
::profiler_gui::spin_lock m_spin; ::profiler_gui::spin_lock m_spin;
::std::atomic_bool m_bReady; ::std::atomic_bool m_bReady;
public: public:
explicit EasyHystogramItem(); explicit EasyHistogramItem();
virtual ~EasyHystogramItem(); virtual ~EasyHistogramItem();
// Public virtual methods // Public virtual methods
@ -182,8 +185,18 @@ public:
void validateName(); void validateName();
void updateImage(); void updateImage();
void increaseTopBoundary();
void decreaseTopBoundary();
void increaseBottomBoundary();
void decreaseBottomBoundary();
void setMouseY(qreal _mouseY);
private: private:
void paintBusyIndicator(QPainter* _painter, qreal _current_scale);
void paintMouseIndicator(QPainter* _painter, qreal _top, qreal _bottom, qreal _width, qreal _height, qreal _top_width, qreal _mouse_y, qreal _delta_time, int _font_h);
void paintByPtr(QPainter* _painter); void paintByPtr(QPainter* _painter);
void paintById(QPainter* _painter); void paintById(QPainter* _painter);
void onTimeout(); void onTimeout();
@ -192,7 +205,7 @@ private:
qreal _value, qreal _width, bool _bindMode, qreal _value, qreal _width, bool _bindMode,
float _frame_time, ::profiler::timestamp_t _begin_time); float _frame_time, ::profiler::timestamp_t _begin_time);
}; // END of class EasyHystogramItem. }; // END of class EasyHistogramItem.
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@ -213,7 +226,7 @@ private:
Qt::MouseButtons m_mouseButtons; Qt::MouseButtons m_mouseButtons;
EasyGraphicsSliderItem* m_slider; EasyGraphicsSliderItem* m_slider;
EasyGraphicsSliderItem* m_chronometerIndicator; EasyGraphicsSliderItem* m_chronometerIndicator;
EasyHystogramItem* m_hystogramItem; EasyHistogramItem* m_histogramItem;
int m_defaultFontHeight; int m_defaultFontHeight;
bool m_bScrolling; bool m_bScrolling;
bool m_bBindMode; bool m_bBindMode;

View File

@ -67,7 +67,7 @@ namespace profiler_gui {
, blocks_size_min(2) , blocks_size_min(2)
, blocks_narrow_size(20) , blocks_narrow_size(20)
, chrono_text_position(ChronoTextPosition_Center) , chrono_text_position(ChronoTextPosition_Center)
, time_units(TimeUnits_auto) , time_units(TimeUnits_ms)
, connected(false) , connected(false)
, use_decorated_thread_name(true) , use_decorated_thread_name(true)
, enable_event_indicators(true) , enable_event_indicators(true)

View File

@ -141,7 +141,7 @@ namespace profiler_gui {
::profiler::thread_id_t selected_thread; ///< Current selected thread id ::profiler::thread_id_t selected_thread; ///< Current selected thread id
::profiler::block_index_t selected_block; ///< Current selected profiler block index ::profiler::block_index_t selected_block; ///< Current selected profiler block index
::profiler::block_id_t selected_block_id; ///< Current selected profiler block id ::profiler::block_id_t selected_block_id; ///< Current selected profiler block id
float frame_time; ///< Value in microseconds to be displayed at minimap on graphics scrollbar float frame_time; ///< Expected frame time value in microseconds to be displayed at minimap on graphics scrollbar
int blocks_spacing; ///< Minimum blocks spacing on diagram int blocks_spacing; ///< Minimum blocks spacing on diagram
int blocks_size_min; ///< Minimum blocks size on diagram int blocks_size_min; ///< Minimum blocks size on diagram
int blocks_narrow_size; ///< Width indicating narrow blocks int blocks_narrow_size; ///< Width indicating narrow blocks

View File

@ -501,7 +501,7 @@ EasyMainWindow::EasyMainWindow() : Parent(), m_lastAddress("localhost"), m_lastP
toolbar->setContentsMargins(1, 0, 1, 0); toolbar->setContentsMargins(1, 0, 1, 0);
toolbar->setMinimumHeight(tb_height); toolbar->setMinimumHeight(tb_height);
lbl = new QLabel("Frame time:", toolbar); lbl = new QLabel("Expected frame time:", toolbar);
lbl->setContentsMargins(5, 2, 2, 2); lbl->setContentsMargins(5, 2, 2, 2);
toolbar->addWidget(lbl); toolbar->addWidget(lbl);