Now the Quick Context Menu can be used to hide all data from a CPU core. The CPU Id value is added to the list of CPUs to be filtered-out. Signed-off-by: Yordan Karadzhov <ykaradzhov@xxxxxxxxxx> --- kernel-shark-qt/src/KsQuickContextMenu.cpp | 26 ++++++++++++++++++++++ kernel-shark-qt/src/KsQuickContextMenu.hpp | 6 +++++ 2 files changed, 32 insertions(+) diff --git a/kernel-shark-qt/src/KsQuickContextMenu.cpp b/kernel-shark-qt/src/KsQuickContextMenu.cpp index 16b8d19..95ffc4f 100644 --- a/kernel-shark-qt/src/KsQuickContextMenu.cpp +++ b/kernel-shark-qt/src/KsQuickContextMenu.cpp @@ -54,6 +54,7 @@ KsQuickContextMenu::KsQuickContextMenu(KsDataStore *data, size_t row, _showTaskAction(this), _hideEventAction(this), _showEventAction(this), + _hideCPUAction(this), _addCPUPlotAction(this), _addTaskPlotAction(this), _removeCPUPlotAction(this), @@ -108,6 +109,9 @@ KsQuickContextMenu::KsQuickContextMenu(KsDataStore *data, size_t row, descr += "] only"; lamAddAction(&_showEventAction, &KsQuickContextMenu::_showEvent); + descr = QString("Hide CPU [%1]").arg(_data->rows()[_row]->cpu); + lamAddAction(&_hideCPUAction, &KsQuickContextMenu::_hideCPU); + if (parentName == "KsTraceViewer") { descr = "Add ["; descr += taskName; @@ -194,6 +198,28 @@ void KsQuickContextMenu::_showEvent() _data->applyPosEventFilter(QVector<int>(1, eventId)); } +void KsQuickContextMenu::_hideCPU() +{ + kshark_context *kshark_ctx(nullptr); + QVector<int> vec; + + if (!kshark_instance(&kshark_ctx)) + return; + + vec =_getFilterVector(kshark_ctx->hide_cpu_filter, + _data->rows()[_row]->cpu); + _data->applyNegCPUFilter(vec); +} + +QVector<int> KsQuickContextMenu::_getFilterVector(tracecmd_filter_id *filter, int newId) +{ + QVector<int> vec = KsUtils::getFilterIds(filter); + if (!vec.contains(newId)) + vec.append(newId); + + return vec; +} + void KsQuickContextMenu::_addTaskPlot() { int pid = kshark_get_pid_easy(_data->rows()[_row]); diff --git a/kernel-shark-qt/src/KsQuickContextMenu.hpp b/kernel-shark-qt/src/KsQuickContextMenu.hpp index 040942f..6ca1b08 100644 --- a/kernel-shark-qt/src/KsQuickContextMenu.hpp +++ b/kernel-shark-qt/src/KsQuickContextMenu.hpp @@ -71,6 +71,8 @@ private: void _showEvent(); + void _hideCPU(); + void _addCPUPlot(); void _addTaskPlot(); @@ -79,6 +81,8 @@ private: void _removeTaskPlot(); + QVector<int> _getFilterVector(tracecmd_filter_id *filter, int newId); + KsDataStore *_data; size_t _row; @@ -87,6 +91,8 @@ private: QAction _hideEventAction, _showEventAction; + QAction _hideCPUAction; + QAction _addCPUPlotAction; QAction _addTaskPlotAction; -- 2.17.1