From patchwork Wed Nov 28 15:16:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10760047 Return-Path: Received: from mail-eopbgr710075.outbound.protection.outlook.com ([40.107.71.75]:2944 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728413AbeK2CSf (ORCPT ); Wed, 28 Nov 2018 21:18:35 -0500 From: Yordan Karadzhov To: "rostedt@goodmis.org" CC: "linux-trace-devel@vger.kernel.org" Subject: [PATCH 13/17] kernel-shark-qt: Add CPU-based filtering to KsDataStore Date: Wed, 28 Nov 2018 15:16:23 +0000 Message-ID: <20181128151530.21965-14-ykaradzhov@vmware.com> References: <20181128151530.21965-1-ykaradzhov@vmware.com> In-Reply-To: <20181128151530.21965-1-ykaradzhov@vmware.com> Content-Language: en-US MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 1957 This patch adds to the KsDataStore class methods for CPU filtering. Signed-off-by: Yordan Karadzhov --- kernel-shark-qt/src/KsUtils.cpp | 21 +++++++++++++++++++-- kernel-shark-qt/src/KsUtils.hpp | 4 ++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/kernel-shark-qt/src/KsUtils.cpp b/kernel-shark-qt/src/KsUtils.cpp index c0e0f7d..2ebbae3 100644 --- a/kernel-shark-qt/src/KsUtils.cpp +++ b/kernel-shark-qt/src/KsUtils.cpp @@ -269,12 +269,17 @@ void KsDataStore::_applyIdFilter(int filterId, QVector vec) kshark_filter_clear(kshark_ctx, KS_SHOW_TASK_FILTER); kshark_filter_clear(kshark_ctx, KS_HIDE_TASK_FILTER); break; + case KS_SHOW_CPU_FILTER: + case KS_HIDE_CPU_FILTER: + kshark_filter_clear(kshark_ctx, KS_SHOW_CPU_FILTER); + kshark_filter_clear(kshark_ctx, KS_HIDE_CPU_FILTER); + break; default: return; } - for (auto &&pid: vec) - kshark_filter_add_id(kshark_ctx, filterId, pid); + for (auto &&val: vec) + kshark_filter_add_id(kshark_ctx, filterId, val); if (!_tep) return; @@ -319,6 +324,18 @@ void KsDataStore::applyNegEventFilter(QVector vec) _applyIdFilter(KS_HIDE_EVENT_FILTER, vec); } +/** Apply Show CPU filter. */ +void KsDataStore::applyPosCPUFilter(QVector vec) +{ + _applyIdFilter(KS_SHOW_CPU_FILTER, vec); +} + +/** Apply Hide CPU filter. */ +void KsDataStore::applyNegCPUFilter(QVector vec) +{ + _applyIdFilter(KS_HIDE_CPU_FILTER, vec); +} + /** Disable all filters. */ void KsDataStore::clearAllFilters() { diff --git a/kernel-shark-qt/src/KsUtils.hpp b/kernel-shark-qt/src/KsUtils.hpp index 888ed56..052cc71 100644 --- a/kernel-shark-qt/src/KsUtils.hpp +++ b/kernel-shark-qt/src/KsUtils.hpp @@ -156,6 +156,10 @@ public: void applyNegEventFilter(QVector); + void applyPosCPUFilter(QVector); + + void applyNegCPUFilter(QVector); + void clearAllFilters(); signals: