@@ -36,6 +36,27 @@ QVector<int> getPidList()
return pids;
}
+/** @brief Get a sorted vector of Id values of a filter. */
+QVector<int> getFilterIds(tracecmd_filter_id *filter)
+{
+ kshark_context *kshark_ctx(nullptr);
+ int *cpuFilter, n;
+ QVector<int> v;
+
+ if (!kshark_instance(&kshark_ctx))
+ return v;
+
+ cpuFilter = tracecmd_filter_ids(filter);
+ n = filter->count;
+ for (int i = 0; i < n; ++i)
+ v.append(cpuFilter[i]);
+
+ qSort(v);
+
+ free(cpuFilter);
+ return v;
+}
+
/**
* Set the bit of the filter mask of the kshark session context responsible
* for the visibility of the events in the Table View.
@@ -84,6 +84,8 @@ namespace KsUtils {
QVector<int> getPidList();
+QVector<int> getFilterIds(tracecmd_filter_id *filter);
+
/** @brief Geat the list of plugins. */
inline QStringList getPluginList() {return plugins.split(";");}
This patch adds to KsUtils a method which can be used to retrieve a vector of sorted Id values associated with a given filter. The method will be used by the Quick Context Menu widget. Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> --- kernel-shark-qt/src/KsUtils.cpp | 21 +++++++++++++++++++++ kernel-shark-qt/src/KsUtils.hpp | 2 ++ 2 files changed, 23 insertions(+)