On 12/14/22 22:46, Steven Rostedt wrote:
From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx> 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 StevenI 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@xxxxxxxxxxx> --- 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.hppindex 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;
From 99bce082ff08b2fb4ca20a4f6bfc32ee043f23dc Mon Sep 17 00:00:00 2001 From: Yordan Karadzhov <y.karadz@xxxxxxxxx> 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@xxxxxxxxx> --- 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