diff options
author | Yordan Karadzhov (VMware) <y.karadz@gmail.com> | 2021-02-11 12:31:50 +0200 |
---|---|---|
committer | Yordan Karadzhov (VMware) <y.karadz@gmail.com> | 2021-02-16 10:25:14 +0200 |
commit | fc14e40e045d1ce01aaf2c3801783737ff04c771 (patch) | |
tree | 5eea53d157f94aa898c9f1017faa6a70d55017ed | |
parent | 0d10850f2428daa86181e8d59de422c8e654bc2a (diff) | |
download | kernel-shark-fc14e40e045d1ce01aaf2c3801783737ff04c771.tar.gz |
kernel-shark: Add combo point to Mark
KsPlot::Mark uses colored point to highlight the selected trace event
on CPU and Task plots. Here we add a combo point that will highlight
the selected event in Combo plots, like "Virtual Combo" for example.
Those Combo plots will be introduced at the level of the GUI code in
successive patches.
Link: https://lore.kernel.org/linux-trace-devel/20210211103205.418588-13-y.karadz@gmail.com
Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
-rw-r--r-- | src/KsPlotTools.cpp | 23 | ||||
-rw-r--r-- | src/KsPlotTools.hpp | 15 |
2 files changed, 36 insertions, 2 deletions
diff --git a/src/KsPlotTools.cpp b/src/KsPlotTools.cpp index ac9c5b2e..225dc341 100644 --- a/src/KsPlotTools.cpp +++ b/src/KsPlotTools.cpp @@ -701,7 +701,7 @@ void Mark::_draw(const Color &col, float size) const void Mark::setDPR(int dpr) { _size = 1.5 * dpr; - _task._size = _cpu._size = 1.5 + 4.0 * dpr; + _task._size = _cpu._size = _combo._size = 1.5 + 4.0 * dpr; } /** @@ -715,6 +715,7 @@ void Mark::setX(int x) _b.setX(x); _cpu.setX(x); _task.setX(x); + _combo.setX(x); } /** @@ -770,6 +771,26 @@ void Mark::setTaskVisible(bool v) } /** + * @brief Set the visiblity of the Mark's Combo point. + * + * @param v: If True, the Task point will be visible. + */ +void Mark::setComboVisible(bool v) +{ + _combo._visible = v; +} + +/** + * @brief Set the Y coordinates (vertical) of the Mark's Combo points. + * + * @param yCombo: Y coordinate of the Mark's Task point. + */ +void Mark::setComboY(int yCombo) +{ + _combo.setY(yCombo); +} + +/** * @brief Create a default Bin. */ Bin::Bin() diff --git a/src/KsPlotTools.hpp b/src/KsPlotTools.hpp index c993181d..a9a5ba8e 100644 --- a/src/KsPlotTools.hpp +++ b/src/KsPlotTools.hpp @@ -406,6 +406,16 @@ public: /** If True, the Mark will be plotted as a dashed line. */ void setDashed(bool d) {_dashed = d;} + /** Get the Y coordinate of the Mark's Combo point. */ + int comboY() const {return _combo.y();} + + void setComboY(int yCombo); + + /** Is the Combo point visible. */ + bool comboIsVisible() const {return _combo._visible;} + + void setComboVisible(bool v); + private: void _draw(const Color &col, float size = 1.) const override; @@ -421,7 +431,10 @@ private: /** A point indicating the position of the Mark in a Task graph. */ Point _task; - /* If True, plot the Mark as a dashed line. */ + /** A point indicating the position of the Mark in a Combo graph. */ + Point _combo; + + /** If True, plot the Mark as a dashed line. */ bool _dashed; }; |