From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org, julia.lawall@inria.fr,
"Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Subject: [PATCH 1/2] kernel-shark: Add methods for selecting the plots to be shown
Date: Fri, 24 Apr 2020 16:25:41 +0300 [thread overview]
Message-ID: <20200424132542.1620-2-y.karadz@gmail.com> (raw)
In-Reply-To: <20200424132542.1620-1-y.karadz@gmail.com>
The methods are added to the public interface of the KsMainWindow class
and can be used to pre-select the CPU and Task plots to be shown, before
opening the GUI.
Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
kernel-shark/src/KsGLWidget.cpp | 6 ++---
kernel-shark/src/KsMainWindow.cpp | 39 +++++++++++++++++++++++++++++++
kernel-shark/src/KsMainWindow.hpp | 4 ++++
3 files changed, 46 insertions(+), 3 deletions(-)
diff --git a/kernel-shark/src/KsGLWidget.cpp b/kernel-shark/src/KsGLWidget.cpp
index e930006..f5a96ac 100644
--- a/kernel-shark/src/KsGLWidget.cpp
+++ b/kernel-shark/src/KsGLWidget.cpp
@@ -369,9 +369,9 @@ void KsGLWidget::loadData(KsDataStore *data)
_model.fill(_data->rows(), _data->size());
/* Make a default CPU list. All CPUs will be plotted. */
- _cpuList = {};
- for (int i = 0; i < nCPUs; ++i)
- _cpuList.append(i);
+ if (_cpuList.isEmpty())
+ for (int i = 0; i < nCPUs; ++i)
+ _cpuList.append(i);
/* Make a default task list. No tasks will be plotted. */
_taskList = {};
diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp
index a5a399c..333e14b 100644
--- a/kernel-shark/src/KsMainWindow.cpp
+++ b/kernel-shark/src/KsMainWindow.cpp
@@ -172,6 +172,45 @@ KsMainWindow::~KsMainWindow()
kshark_free(kshark_ctx);
}
+/** Set the list ot CPU cores to be plotted. */
+void KsMainWindow::setCPUPlots(QVector<int> cpus)
+{
+ int nCPUs = tep_get_cpus(_data.tep());
+ auto lamCPUCheck = [=] (int cpu) {
+ if (cpu >= nCPUs) {
+ qWarning() << "Warning: No CPU" << cpu << "found in the data.";
+ return true;
+ }
+
+ return false;
+ };
+
+ cpus.erase(std::remove_if(cpus.begin(), cpus.end(), lamCPUCheck),
+ cpus.end());
+
+ _graph.cpuReDraw(cpus);
+}
+
+/** Set the list ot tasks (pids) to be plotted. */
+void KsMainWindow::setTaskPlots(QVector<int> pids)
+{
+ QVector<int> allPids = KsUtils::getPidList();
+ auto lamPidCheck = [=] (int pid) {
+ int i = allPids.indexOf(pid);
+ if (i < 0) {
+ qWarning() << "Warning: No Pid" << pid << "found in the data.";
+ return true;
+ }
+
+ return false;
+ };
+
+ pids.erase(std::remove_if(pids.begin(), pids.end(), lamPidCheck),
+ pids.end());
+
+ _graph.taskReDraw(pids);
+}
+
/**
* Reimplemented event handler used to update the geometry of the window on
* resize events.
diff --git a/kernel-shark/src/KsMainWindow.hpp b/kernel-shark/src/KsMainWindow.hpp
index eef4f96..774e1c9 100644
--- a/kernel-shark/src/KsMainWindow.hpp
+++ b/kernel-shark/src/KsMainWindow.hpp
@@ -61,6 +61,10 @@ public:
_plugins.unregisterPlugin(plugin);
}
+ void setCPUPlots(QVector<int> cpus);
+
+ void setTaskPlots(QVector<int> pids);
+
void resizeEvent(QResizeEvent* event);
/** Set the Full Screen mode. */
--
2.20.1
next prev parent reply other threads:[~2020-04-24 13:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-24 13:25 [PATCH 0/2] Command line options for selecting plots Yordan Karadzhov (VMware)
2020-04-24 13:25 ` Yordan Karadzhov (VMware) [this message]
2020-04-24 13:25 ` [PATCH 2/2] kernel-shark: Add command line options for selecting plots to be shown Yordan Karadzhov (VMware)
2020-05-04 19:13 ` Steven Rostedt
2020-05-04 19:17 ` Julia Lawall
2020-05-08 13:11 ` Yordan Karadzhov (VMware)
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=20200424132542.1620-2-y.karadz@gmail.com \
--to=y.karadz@gmail.com \
--cc=julia.lawall@inria.fr \
--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).