diff mbox series

[13/17] kernel-shark-qt: Add CPU-based filtering to KsDataStore

Message ID 20181128151530.21965-14-ykaradzhov@vmware.com (mailing list archive)
State Accepted
Commit 178ff78ae05942498b8397fd95773f8c30b9a644
Headers show
Series More modifications and bug fixes toward KS 1.0 | expand

Commit Message

Yordan Karadzhov Nov. 28, 2018, 3:16 p.m. UTC
This patch adds to the KsDataStore class methods for CPU filtering.

Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
 kernel-shark-qt/src/KsUtils.cpp | 21 +++++++++++++++++++--
 kernel-shark-qt/src/KsUtils.hpp |  4 ++++
 2 files changed, 23 insertions(+), 2 deletions(-)
diff mbox series

Patch

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<int> 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<int> vec)
 	_applyIdFilter(KS_HIDE_EVENT_FILTER, vec);
 }
 
+/** Apply Show CPU filter. */
+void KsDataStore::applyPosCPUFilter(QVector<int> vec)
+{
+	_applyIdFilter(KS_SHOW_CPU_FILTER, vec);
+}
+
+/** Apply Hide CPU filter. */
+void KsDataStore::applyNegCPUFilter(QVector<int> 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<int>);
 
+	void applyPosCPUFilter(QVector<int>);
+
+	void applyNegCPUFilter(QVector<int>);
+
 	void clearAllFilters();
 
 signals: