kernel-shark: Show multi-line events in quick view
PATCH 1/1 kernel-shark: Show multi-line events in quick view
From: "Steven Rostedt (Google)" <[email protected]>
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.
--- src/KsQuickContextMenu.cpp | 9 +++++++++ src/KsQuickContextMenu.hpp | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-)
src/KsQuickContextMenu.cpp +9 -0
@@ -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);
src/KsQuickContextMenu.hpp +1 -1
@@ -91,7 +91,7 @@ private: size_t _row; - QWidgetAction _rawTime, _rawEvent; + QWidgetAction _rawTime, _rawEvent, _eventInfo; QCheckBox *_graphSyncCBox, *_listSyncCBox;
Signature · 1 line
2.35.1
Quoted 7 lines · Steven Rostedt
From: "Steven Rostedt (Google)" <[email protected]>
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.
Quoted 38 lines
Signed-off-by Steven Rostedt (Google) <[email protected]>--- src/KsQuickContextMenu.cpp | 9 +++++++++ src/KsQuickContextMenu.hpp | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-)src/KsQuickContextMenu.cpp +9
-0@@ -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);src/KsQuickContextMenu.hpp +0
-0
src/KsQuickContextMenu.hpp private: · line 97
Quoted 8 lines
src/KsQuickContextMenu.hpp +1
-1@@ -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 <[email protected]>
Date: Tue, 20 Dec 2022 18:45:30 +0200
Subject: [RFC PATCH] kernel-shark: Show multi-line events using the dual
marker
--- src/KsTraceViewer.cpp | 18 +++++++++++++++++- src/KsTraceViewer.hpp | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-)
src/KsTraceViewer.cpp +17 -1
@@ -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);
src/KsTraceViewer.hpp +2 -0
@@ -106,6 +106,8 @@ private: KsFilterProxyModel _proxyModel; + QItemSelectionModel _selectionModel; + QToolBar _toolbar; QLabel _labelSearch, _labelGrFollows;
Signature · 1 line
2.37.3
Quoted 6 lines · On Tue, 20 Dec 2022 18:51:03 +0200 Yordan Karadzhov <[email protected]> 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 ;-)
Quoted 10 lines
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
Quoted 3 lines · Steven Rostedt
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.