linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yordan Karadzhov <ykaradzhov@vmware.com>
To: "rostedt@goodmis.org" <rostedt@goodmis.org>
Cc: "linux-trace-devel@vger.kernel.org" <linux-trace-devel@vger.kernel.org>
Subject: [PATCH 3/5] kernel-shark-qt: Improuve the KsQuickContextMenu
Date: Wed, 12 Dec 2018 16:58:47 +0000	[thread overview]
Message-ID: <20181212165826.8218-4-ykaradzhov@vmware.com> (raw)
In-Reply-To: <20181212165826.8218-1-ykaradzhov@vmware.com>

In this patch the KsQuickContextMenu gets upgraded according
to the user feedback received from Steven. First of all a
"Show CPU X only" action is added to the version of the menu
that gets opened from the Table widget. In addition to this
"Apply filter to XX" check-boxes are added in order to control
the visibility of the filtered data.

Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
 kernel-shark-qt/src/KsQuickContextMenu.cpp | 39 ++++++++++++++++++++++
 kernel-shark-qt/src/KsQuickContextMenu.hpp |  6 +++-
 2 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/kernel-shark-qt/src/KsQuickContextMenu.cpp b/kernel-shark-qt/src/KsQuickContextMenu.cpp
index 815e4b9..c225269 100644
--- a/kernel-shark-qt/src/KsQuickContextMenu.cpp
+++ b/kernel-shark-qt/src/KsQuickContextMenu.cpp
@@ -50,11 +50,14 @@ KsQuickContextMenu::KsQuickContextMenu(KsDataStore *data, size_t row,
 : KsQuickMarkerMenu(dm, parent),
   _data(data),
   _row(row),
+  _graphSyncCBox(nullptr),
+  _listSyncCBox(nullptr),
   _hideTaskAction(this),
   _showTaskAction(this),
   _hideEventAction(this),
   _showEventAction(this),
   _hideCPUAction(this),
+  _showCPUAction(this),
   _addCPUPlotAction(this),
   _addTaskPlotAction(this),
   _removeCPUPlotAction(this),
@@ -85,6 +88,32 @@ KsQuickContextMenu::KsQuickContextMenu(KsDataStore *data, size_t row,
 	parentName = parent->metaObject()->className();
 
 	addSection("Pointer menu");
+
+	if (parentName == "KsTraceViewer") {
+		_graphSyncCBox =
+			KsUtils::addCheckBoxToMenu(this, "Apply filters to Graph");
+
+		connect(_graphSyncCBox,	&QCheckBox::stateChanged,
+					&KsUtils::graphFilterSync);
+
+		bool state(false);
+		KsUtils::graphFilterSync(state);
+		_graphSyncCBox->setChecked(state);
+	}
+
+	if (parentName == "KsTraceGraph" &&
+	    (graphs = dynamic_cast<KsTraceGraph *>(parent))) {
+		_listSyncCBox =
+			KsUtils::addCheckBoxToMenu(this, "Apply filters to Graph");
+
+		connect(_listSyncCBox,	&QCheckBox::stateChanged,
+					&KsUtils::listFilterSync);
+
+		bool state(false);
+		KsUtils::listFilterSync(state);
+		_listSyncCBox->setChecked(state);
+	}
+
 	descr = "Hide task [";
 	descr += taskName;
 	descr += "-";
@@ -113,6 +142,9 @@ KsQuickContextMenu::KsQuickContextMenu(KsDataStore *data, size_t row,
 	lamAddAction(&_hideCPUAction, &KsQuickContextMenu::_hideCPU);
 
 	if (parentName == "KsTraceViewer") {
+		descr = QString("Show CPU [%1] only").arg(cpu);
+		lamAddAction(&_showCPUAction, &KsQuickContextMenu::_showCPU);
+
 		descr = "Add [";
 		descr += taskName;
 		descr += "-";
@@ -198,6 +230,13 @@ void KsQuickContextMenu::_showEvent()
 	_data->applyPosEventFilter(QVector<int>(1, eventId));
 }
 
+void KsQuickContextMenu::_showCPU()
+{
+	int cpu = _data->rows()[_row]->cpu;
+
+	_data->applyPosCPUFilter(QVector<int>(1, cpu));
+}
+
 void KsQuickContextMenu::_hideCPU()
 {
 	kshark_context *kshark_ctx(nullptr);
diff --git a/kernel-shark-qt/src/KsQuickContextMenu.hpp b/kernel-shark-qt/src/KsQuickContextMenu.hpp
index 6ca1b08..f5a2a78 100644
--- a/kernel-shark-qt/src/KsQuickContextMenu.hpp
+++ b/kernel-shark-qt/src/KsQuickContextMenu.hpp
@@ -71,6 +71,8 @@ private:
 
 	void _showEvent();
 
+	void _showCPU();
+
 	void _hideCPU();
 
 	void _addCPUPlot();
@@ -87,11 +89,13 @@ private:
 
 	size_t		_row;
 
+	QCheckBox	*_graphSyncCBox, *_listSyncCBox;
+
 	QAction _hideTaskAction, _showTaskAction;
 
 	QAction _hideEventAction, _showEventAction;
 
-	QAction _hideCPUAction;
+	QAction _hideCPUAction, _showCPUAction;
 
 	QAction _addCPUPlotAction;
 
-- 
2.17.1

  parent reply	other threads:[~2018-12-12 16:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-12 16:58 [PATCH 0/5] More modifications toward KS 1.0 Yordan Karadzhov
2018-12-12 16:58 ` [PATCH 1/5] kernel-shark-qt: Avoid spurious searches Yordan Karadzhov
2018-12-14  3:47   ` Steven Rostedt
2018-12-14 12:02     ` Yordan Karadzhov (VMware)
2018-12-12 16:58 ` [PATCH 2/5] kernel-shark-qt: Create "Apply filter XX" checkboxes in KsUtils Yordan Karadzhov
2018-12-12 16:58 ` Yordan Karadzhov [this message]
2018-12-12 16:58 ` [PATCH 4/5] kernel-shark-qt: Update the documentation link Yordan Karadzhov
2018-12-12 16:58 ` [PATCH 5/5] kernel-shark-qt: Version 1.0.0 Yordan Karadzhov

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=20181212165826.8218-4-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).