diff options
author | Yordan Karadzhov <ykaradzhov@vmware.com> | 2019-05-15 12:09:10 -0700 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2019-05-21 09:58:40 -0400 |
commit | 8384febecd15060d8ffd81061b87c2c614bba2f9 (patch) | |
tree | 6b99defb25a80faec08c687748a8b497c9452e3c | |
parent | 0947f612dede562179fba3e481b19d67c334d13c (diff) | |
download | trace-cmd-8384febecd15060d8ffd81061b87c2c614bba2f9.tar.gz |
kernel-shark: Improve the appearance on high screen resolution
Some of the components of the plots haven't been properly scaled
when displayed on high screen resolution.
Link: http://lore.kernel.org/linux-trace-devel/20190515190911.20755-6-ykaradzhov@vmware.com
Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r-- | kernel-shark/src/KsGLWidget.cpp | 24 | ||||
-rw-r--r-- | kernel-shark/src/KsGLWidget.hpp | 2 | ||||
-rw-r--r-- | kernel-shark/src/KsPlotTools.cpp | 4 |
3 files changed, 18 insertions, 12 deletions
diff --git a/kernel-shark/src/KsGLWidget.cpp b/kernel-shark/src/KsGLWidget.cpp index 789514a6..ce680526 100644 --- a/kernel-shark/src/KsGLWidget.cpp +++ b/kernel-shark/src/KsGLWidget.cpp @@ -84,24 +84,29 @@ void KsGLWidget::resizeGL(int w, int h) /** Reimplemented function used to plot trace graphs. */ void KsGLWidget::paintGL() { + float size = 1.5 * _dpr; + glClear(GL_COLOR_BUFFER_BIT); /* Draw the time axis. */ if(_data) - _drawAxisX(); + _drawAxisX(size); /* Process and draw all graphs by using the built-in logic. */ _makeGraphs(_cpuList, _taskList); for (auto const &g: _graphs) - g->draw(1.5 * _dpr); + g->draw(size); /* Process and draw all plugin-specific shapes. */ _makePluginShapes(_cpuList, _taskList); while (!_shapes.empty()) { auto s = _shapes.front(); + _shapes.pop_front(); + + s->_size = size; s->draw(); + delete s; - _shapes.pop_front(); } /* @@ -448,22 +453,21 @@ void KsGLWidget::findGraphIds(const kshark_entry &e, *graphTask = -1; } -void KsGLWidget::_drawAxisX() +void KsGLWidget::_drawAxisX(float size) { KsPlot::Point a0(_hMargin, _vMargin / 4), a1(_hMargin, _vMargin / 2); - KsPlot::Point b0(width()/2, _vMargin / 4), b1(width() / 2, _vMargin / 2); + KsPlot::Point b0(width() / 2, _vMargin / 4), b1(width() / 2, _vMargin / 2); KsPlot::Point c0(width() - _hMargin, _vMargin / 4), c1(width() - _hMargin, _vMargin / 2); - int lineSize = 2 * _dpr; a0._size = c0._size = _dpr; a0.draw(); c0.draw(); - KsPlot::drawLine(a0, a1, {}, lineSize); - KsPlot::drawLine(b0, b1, {}, lineSize); - KsPlot::drawLine(c0, c1, {}, lineSize); - KsPlot::drawLine(a0, c0, {}, lineSize); + KsPlot::drawLine(a0, a1, {}, size); + KsPlot::drawLine(b0, b1, {}, size); + KsPlot::drawLine(c0, c1, {}, size); + KsPlot::drawLine(a0, c0, {}, size); } void KsGLWidget::_makeGraphs(QVector<int> cpuList, QVector<int> taskList) diff --git a/kernel-shark/src/KsGLWidget.hpp b/kernel-shark/src/KsGLWidget.hpp index bf68be35..82831cfb 100644 --- a/kernel-shark/src/KsGLWidget.hpp +++ b/kernel-shark/src/KsGLWidget.hpp @@ -189,7 +189,7 @@ private: int _dpr; - void _drawAxisX(); + void _drawAxisX(float size); void _makeGraphs(QVector<int> cpuMask, QVector<int> taskMask); diff --git a/kernel-shark/src/KsPlotTools.cpp b/kernel-shark/src/KsPlotTools.cpp index 2b16a51c..f95ada5a 100644 --- a/kernel-shark/src/KsPlotTools.cpp +++ b/kernel-shark/src/KsPlotTools.cpp @@ -1089,8 +1089,10 @@ void Graph::draw(float size) /* Draw as vartical lines all bins containing data. */ for (int i = 0; i < _size; ++i) if (_bins[i]._idFront >= 0 || _bins[i]._idBack >= 0) - if (_bins[i]._visMask & KS_EVENT_VIEW_FILTER_MASK) + if (_bins[i]._visMask & KS_EVENT_VIEW_FILTER_MASK) { + _bins[i]._size = size; _bins[i].draw(); + } auto lamCheckEnsblVal = [this] (int v) { return v > 0 || (v == 0 && !this->_zeroSuppress); |