From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
To: linux-trace-devel@vger.kernel.org
Cc: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Subject: [PATCH 2/2] kernel-shark: CPU plots dialog ease spotting empty CPUs
Date: Wed, 16 Mar 2022 16:37:17 +0200 [thread overview]
Message-ID: <20220316143717.272899-2-y.karadz@gmail.com> (raw)
In-Reply-To: <20220316143717.272899-1-y.karadz@gmail.com>
The CPU plots dialog will show only the ones with content. A "hide empty"
checkbox is added, that by default is checked. If it is unchecked, then
all the CPUs would show up.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=215677
Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
src/KsWidgetsLib.cpp | 26 +++++++++++++++++++++++++-
src/KsWidgetsLib.hpp | 7 +++++--
2 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/src/KsWidgetsLib.cpp b/src/KsWidgetsLib.cpp
index e30bf27..7b3192d 100644
--- a/src/KsWidgetsLib.cpp
+++ b/src/KsWidgetsLib.cpp
@@ -906,12 +906,35 @@ void KsCheckBoxTreeWidget::_verify()
* @param parent: The parent of this widget.
*/
KsCPUCheckBoxWidget::KsCPUCheckBoxWidget(kshark_data_stream *stream, QWidget *parent)
-: KsCheckBoxTreeWidget(stream->stream_id, "CPUs", parent)
+: KsCheckBoxTreeWidget(stream->stream_id, "CPUs", parent),
+ _hideEmpty("hide empty")
{
int height(FONT_HEIGHT * 1.5);
KsPlot::ColorTable colors;
QString style;
+ _hideEmpty.setCheckState(Qt::Checked);
+ _tb.addSeparator();
+ _tb.addWidget(&_hideEmpty);
+
+ auto lamHideEmpty = [this, stream] (bool hide) {
+ QTreeWidgetItem *item;
+ bool isIdle;
+
+ for(int cpu = 0; cpu < stream->n_cpus; ++cpu) {
+ item = _tree.topLevelItem(cpu);
+ if (hide) {
+ isIdle = kshark_hash_id_find(stream->idle_cpus, cpu);
+ item->setHidden(isIdle);
+ } else {
+ item->setHidden(false);
+ }
+ }
+ };
+
+ connect(&_hideEmpty, &QCheckBox::clicked,
+ lamHideEmpty);
+
style = QString("QTreeView::item { height: %1 ;}").arg(height);
_tree.setStyleSheet(style);
@@ -934,6 +957,7 @@ KsCPUCheckBoxWidget::KsCPUCheckBoxWidget(kshark_data_stream *stream, QWidget *pa
_cb[i] = cpuItem;
}
+ lamHideEmpty(true);
_adjustSize();
}
diff --git a/src/KsWidgetsLib.hpp b/src/KsWidgetsLib.hpp
index 6ec2bd1..2cc3535 100644
--- a/src/KsWidgetsLib.hpp
+++ b/src/KsWidgetsLib.hpp
@@ -275,10 +275,9 @@ public:
/** The user provided an input. The widget has been modified. */
bool _userInput;
-private:
+protected:
QToolBar _tb;
-protected:
/** Identifier of the Data stream for which the selection applies. */
int _sd;
@@ -544,6 +543,10 @@ struct KsCPUCheckBoxWidget : public KsCheckBoxTreeWidget
KsCPUCheckBoxWidget(kshark_data_stream *stream,
QWidget *parent = nullptr);
+
+private:
+ /** The "hide empty" checkbox. */
+ QCheckBox _hideEmpty;
};
/**
--
2.32.0
next prev parent reply other threads:[~2022-03-16 14:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-16 14:37 [PATCH 1/2] kernel-shark: Hide CPUs with no data in them Yordan Karadzhov (VMware)
2022-03-16 14:37 ` Yordan Karadzhov (VMware) [this message]
2022-03-16 15:03 ` [PATCH 2/2] kernel-shark: CPU plots dialog ease spotting empty CPUs Steven Rostedt
2022-03-16 15:11 ` Steven Rostedt
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=20220316143717.272899-2-y.karadz@gmail.com \
--to=y.karadz@gmail.com \
--cc=linux-trace-devel@vger.kernel.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).