* [PATCH] kernel-shark: Show multi-line events in quick view
@ 2022-12-14 20:46 Steven Rostedt
2022-12-20 16:51 ` Yordan Karadzhov
0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2022-12-14 20:46 UTC (permalink / raw)
To: Linux Trace Devel; +Cc: Yordan Karadzhov
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.
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;
--
2.35.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] kernel-shark: Show multi-line events in quick view
2022-12-14 20:46 [PATCH] kernel-shark: Show multi-line events in quick view Steven Rostedt
@ 2022-12-20 16:51 ` Yordan Karadzhov
2022-12-21 16:35 ` Steven Rostedt
0 siblings, 1 reply; 4+ messages in thread
From: Yordan Karadzhov @ 2022-12-20 16:51 UTC (permalink / raw)
To: Steven Rostedt, Linux Trace Devel
[-- 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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] kernel-shark: Show multi-line events in quick view
2022-12-20 16:51 ` Yordan Karadzhov
@ 2022-12-21 16:35 ` Steven Rostedt
2022-12-21 19:27 ` Yordan Karadzhov
0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2022-12-21 16:35 UTC (permalink / raw)
To: Yordan Karadzhov; +Cc: Linux Trace Devel
On Tue, 20 Dec 2022 18:51:03 +0200
Yordan Karadzhov <y.karadz@gmail.com> wrote:
>
> 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.
It doesn't annoy me ;-)
>
> 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.
>
This works too. Either way, as long as I can get to the data.
Also, for another feature request. Is it possible to implement a copy of
the text in the list view? I would like to select text and copy it so that
I can paste it into other windows.
Thanks!
-- Steve
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kernel-shark: Show multi-line events in quick view
2022-12-21 16:35 ` Steven Rostedt
@ 2022-12-21 19:27 ` Yordan Karadzhov
0 siblings, 0 replies; 4+ messages in thread
From: Yordan Karadzhov @ 2022-12-21 19:27 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Linux Trace Devel
On 12/21/22 18:35, Steven Rostedt wrote:
> Also, for another feature request. Is it possible to implement a copy of
> the text in the list view? I would like to select text and copy it so that
> I can paste it into other windows.
Should be possible. I will have a look.
Cheers,
Y.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-12-21 19:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-14 20:46 [PATCH] kernel-shark: Show multi-line events in quick view Steven Rostedt
2022-12-20 16:51 ` Yordan Karadzhov
2022-12-21 16:35 ` Steven Rostedt
2022-12-21 19:27 ` Yordan Karadzhov
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).