From: Yordan Karadzhov <ykaradzhov@vmware.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org,
Yordan Karadzhov <ykaradzhov@vmware.com>
Subject: [PATCH] kernel-shark: Implement proper reser for the OpenGL widget
Date: Thu, 14 Feb 2019 16:04:51 +0200 [thread overview]
Message-ID: <20190214140451.827-1-ykaradzhov@vmware.com> (raw)
When loading a new trace.dat file the OpenGL widget has to be properly
reset. One important operation of this reset is to set the "_data"
pointer to NULL. This will block all attempts for drawing something
before the widget is set again. The bug was introduced in
7d057ae56 ("kernel-shark-qt: Add Trace Graph widget")
but had no effect until
94efea960 ("kernel-shark-qt: Handle the case when the range of ...")
because the number of bins of the model was zero, so nothing was plotted
anyway.
Reported-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Fixes: 7d057ae56 ("kernel-shark-qt: Add Trace Graph widget")
Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
kernel-shark/src/KsGLWidget.cpp | 9 +++++++++
kernel-shark/src/KsGLWidget.hpp | 2 ++
kernel-shark/src/KsTraceGraph.cpp | 6 ++----
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/kernel-shark/src/KsGLWidget.cpp b/kernel-shark/src/KsGLWidget.cpp
index 917e86d..7a050c2 100644
--- a/kernel-shark/src/KsGLWidget.cpp
+++ b/kernel-shark/src/KsGLWidget.cpp
@@ -109,6 +109,15 @@ void KsGLWidget::paintGL()
_mState->activeMarker().draw();
}
+/** Reset (empty) the widget. */
+void KsGLWidget::reset()
+{
+ _cpuList = {};
+ _taskList = {};
+ _data = nullptr;
+ _model.reset();
+}
+
/** Reimplemented event handler used to receive mouse press events. */
void KsGLWidget::mousePressEvent(QMouseEvent *event)
{
diff --git a/kernel-shark/src/KsGLWidget.hpp b/kernel-shark/src/KsGLWidget.hpp
index 6fbf534..95f307b 100644
--- a/kernel-shark/src/KsGLWidget.hpp
+++ b/kernel-shark/src/KsGLWidget.hpp
@@ -37,6 +37,8 @@ public:
void paintGL() override;
+ void reset();
+
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
diff --git a/kernel-shark/src/KsTraceGraph.cpp b/kernel-shark/src/KsTraceGraph.cpp
index 844c794..6087e96 100644
--- a/kernel-shark/src/KsTraceGraph.cpp
+++ b/kernel-shark/src/KsTraceGraph.cpp
@@ -201,15 +201,13 @@ void KsTraceGraph::setMarkerSM(KsDualMarkerSM *m)
/** Reset (empty) the widget. */
void KsTraceGraph::reset()
{
- /* Clear the all graph lists and update. */
- _glWindow._cpuList = {};
- _glWindow._taskList = {};
+ /* Reset (empty) the OpenGL widget. */
+ _glWindow.reset();
_labelP2.setText("");
for (auto l1: {&_labelI1, &_labelI2, &_labelI3, &_labelI4, &_labelI5})
l1->setText("");
- _glWindow.model()->reset();
_selfUpdate();
for (auto l2: {&_labelXMin, &_labelXMid, &_labelXMax})
l2->setText("");
--
2.17.1
reply other threads:[~2019-02-14 14:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190214140451.827-1-ykaradzhov@vmware.com \
--to=ykaradzhov@vmware.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).