From: Yordan Karadzhov <y.karadz@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>,
Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: Re: [PATCH] kernel-shark: Show multi-line events in quick view
Date: Tue, 20 Dec 2022 18:51:03 +0200 [thread overview]
Message-ID: <4470bb69-1558-5775-67ff-9b6b0779f573@gmail.com> (raw)
In-Reply-To: <20221214154643.43a4e137@gandalf.local.home>
[-- Attachment #1: Type: text/plain, Size: 2610 bytes --]
On 12/14/22 22:46, Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
>
> Some events (stack traces) have multiple lines, but the list view of each
> event is just a single line. To get the content of the full event, if the
> user selects the right mouse button over the event to trigger the quick
> view, display the entire content of the event.
>
Hi Steven
I wonder if the context menu is the best place to display those
multi-line events. This menu is quite busy already and if you want to
check a number of events, each time you have to open it then close it
and reopen it again in order to see the next event. I think this can be
a bit annoying.
An alternative can be to use the dual marker. For example we can make it
to work such that all lines of the event selected with the markers are
shown directly into the table.
I am attaching a RFC patch that that implements this. Note that I didn't
time to fully test and debug this for all corner cases, but it should
work at leas for the most straight-forward use case. Please try it and
tell me what you think.
Thanks!
Y.
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
> src/KsQuickContextMenu.cpp | 9 +++++++++
> src/KsQuickContextMenu.hpp | 2 +-
> 2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/src/KsQuickContextMenu.cpp b/src/KsQuickContextMenu.cpp
> index 6fa242de348d..cc714bfb1aae 100644
> --- a/src/KsQuickContextMenu.cpp
> +++ b/src/KsQuickContextMenu.cpp
> @@ -52,6 +52,7 @@ KsQuickContextMenu::KsQuickContextMenu(KsDualMarkerSM *dm,
> _row(row),
> _rawTime(this),
> _rawEvent(this),
> + _eventInfo(this),
> _graphSyncCBox(nullptr),
> _listSyncCBox(nullptr),
> _hideTaskAction(this),
> @@ -104,6 +105,14 @@ KsQuickContextMenu::KsQuickContextMenu(KsDualMarkerSM *dm,
> evtData += field + ": " + val.setNum(fieldVal) + "\n\t";
> }
>
> + QString evtInfo("\t");
> + evtInfo += kshark_get_info(entry);
> + evtInfo += "\n";
> +
> + addSection("Event info");
> + _eventInfo.setDefaultWidget(new QLabel(evtInfo));
> + addAction(&_eventInfo);
> +
> addSection("Raw event");
> time = QString("\ttime: %1 [ns]").arg(entry->ts);
>
> diff --git a/src/KsQuickContextMenu.hpp b/src/KsQuickContextMenu.hpp
> index ca0b341dd363..c07c1a534d3a 100644
> --- a/src/KsQuickContextMenu.hpp
> +++ b/src/KsQuickContextMenu.hpp
> @@ -91,7 +91,7 @@ private:
>
> size_t _row;
>
> - QWidgetAction _rawTime, _rawEvent;
> + QWidgetAction _rawTime, _rawEvent, _eventInfo;
>
> QCheckBox *_graphSyncCBox, *_listSyncCBox;
>
[-- Attachment #2: 0001-kernel-shark-Show-multi-line-events-using-the-dual-m.patch --]
[-- Type: text/x-patch, Size: 2525 bytes --]
From 99bce082ff08b2fb4ca20a4f6bfc32ee043f23dc Mon Sep 17 00:00:00 2001
From: Yordan Karadzhov <y.karadz@gmail.com>
Date: Tue, 20 Dec 2022 18:45:30 +0200
Subject: [RFC PATCH] kernel-shark: Show multi-line events using the dual
marker
Signed-off-by: Yordan Karadzhov <y.karadz@gmail.com>
---
src/KsTraceViewer.cpp | 18 +++++++++++++++++-
src/KsTraceViewer.hpp | 2 ++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/KsTraceViewer.cpp b/src/KsTraceViewer.cpp
index be0a419..97caaa0 100644
--- a/src/KsTraceViewer.cpp
+++ b/src/KsTraceViewer.cpp
@@ -110,6 +110,20 @@ KsTraceViewer::KsTraceViewer(QWidget *parent)
connect(&_searchFSM._searchRestartButton, &QPushButton::pressed,
this, &KsTraceViewer::_searchContinue);
+ int defaultRowHeight = FONT_HEIGHT * 1.25;
+ auto lamSelectionChanged = [this, defaultRowHeight](const QItemSelection &selected, const QItemSelection &deselected) {
+ if (deselected.count() &&
+ deselected.indexes().first().row() != _mState->passiveMarker()._pos) {
+ _view.verticalHeader()->resizeSection(deselected.indexes().first().row(),
+ defaultRowHeight);
+ }
+ if (selected.count()) {
+ _view.resizeRowToContents(selected.indexes().first().row());
+ }
+ };
+ connect(&_selectionModel, &QItemSelectionModel::selectionChanged,
+ lamSelectionChanged);
+
_searchFSM.placeInToolBar(&_toolbar);
/*
@@ -128,13 +142,15 @@ KsTraceViewer::KsTraceViewer(QWidget *parent)
_view.setEditTriggers(QAbstractItemView::NoEditTriggers);
_view.setSelectionBehavior(QAbstractItemView::SelectRows);
_view.setSelectionMode(QAbstractItemView::SingleSelection);
- _view.verticalHeader()->setDefaultSectionSize(FONT_HEIGHT * 1.25);
+ _view.verticalHeader()->setDefaultSectionSize(defaultRowHeight);
_view.setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
_view.horizontalHeader()->setFont(
QFontDatabase::systemFont(QFontDatabase::GeneralFont));
_proxyModel.setSource(&_model);
+ _selectionModel.setModel(&_proxyModel);
_view.setModel(&_proxyModel);
+ _view.setSelectionModel(&_selectionModel);
connect(&_proxyModel, &QAbstractItemModel::modelReset,
this, &KsTraceViewer::_searchReset);
diff --git a/src/KsTraceViewer.hpp b/src/KsTraceViewer.hpp
index f3979a6..ae1929d 100644
--- a/src/KsTraceViewer.hpp
+++ b/src/KsTraceViewer.hpp
@@ -106,6 +106,8 @@ private:
KsFilterProxyModel _proxyModel;
+ QItemSelectionModel _selectionModel;
+
QToolBar _toolbar;
QLabel _labelSearch, _labelGrFollows;
--
2.37.3
next prev parent reply other threads:[~2022-12-20 16:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-14 20:46 [PATCH] kernel-shark: Show multi-line events in quick view Steven Rostedt
2022-12-20 16:51 ` Yordan Karadzhov [this message]
2022-12-21 16:35 ` Steven Rostedt
2022-12-21 19:27 ` 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=4470bb69-1558-5775-67ff-9b6b0779f573@gmail.com \
--to=y.karadz@gmail.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).