From patchwork Mon Oct 1 13:59:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10759455 Return-Path: Received: from mail-eopbgr730043.outbound.protection.outlook.com ([40.107.73.43]:46085 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729325AbeJAUil (ORCPT ); Mon, 1 Oct 2018 16:38:41 -0400 From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, "Yordan Karadzhov (VMware)" Subject: [PATCH v2 3/5] kernel-shark-qt: Add functions for fast clearing of the filters. Date: Mon, 1 Oct 2018 16:59:19 +0300 Message-Id: <20181001135921.32379-4-ykaradzhov@vmware.com> In-Reply-To: <20181001135921.32379-1-ykaradzhov@vmware.com> References: <20181001135921.32379-1-ykaradzhov@vmware.com> MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 2893 From: "Yordan Karadzhov (VMware)" The first added function checks if any Id filter is set. The second added function is used to reset the "visible" field of each entry to the default value of "0xFF" (visible everywhere). Signed-off-by: Yordan Karadzhov (VMware) --- kernel-shark-qt/src/libkshark.c | 28 +++++++++++++++++++++++++++- kernel-shark-qt/src/libkshark.h | 6 ++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/kernel-shark-qt/src/libkshark.c b/kernel-shark-qt/src/libkshark.c index e7ea007..2aad3b9 100644 --- a/kernel-shark-qt/src/libkshark.c +++ b/kernel-shark-qt/src/libkshark.c @@ -427,7 +427,14 @@ static bool filter_is_set(struct tracecmd_filter_id *filter) return filter && filter->count; } -static bool kshark_filter_is_set(struct kshark_context *kshark_ctx) +/** + * @brief Check if an Id filter is set. + * + * @param kshark_ctx: Input location for the session context pointer. + * + * @returns True if at least one Id filter is set, otherwise False. + */ +bool kshark_filter_is_set(struct kshark_context *kshark_ctx) { return filter_is_set(kshark_ctx->show_task_filter) || filter_is_set(kshark_ctx->hide_task_filter) || @@ -499,6 +506,25 @@ void kshark_filter_entries(struct kshark_context *kshark_ctx, } } +/** + * @brief This function loops over the array of entries specified by "data" + * and "n_entries" and resets the "visible" fields of each entry to + * the default value of "0xFF" (visible everywhere). + * + * @param kshark_ctx: Input location for the session context pointer. + * @param data: Input location for the trace data to be unfiltered. + * @param n_entries: The size of the inputted data. + */ +void kshark_clear_all_filters(struct kshark_context *kshark_ctx, + struct kshark_entry **data, + size_t n_entries) +{ + int i; + + for (i = 0; i < n_entries; ++i) + data[i]->visible = 0xFF; +} + static void kshark_set_entry_values(struct kshark_context *kshark_ctx, struct tep_record *record, struct kshark_entry *entry) diff --git a/kernel-shark-qt/src/libkshark.h b/kernel-shark-qt/src/libkshark.h index d24ed8c..a329e08 100644 --- a/kernel-shark-qt/src/libkshark.h +++ b/kernel-shark-qt/src/libkshark.h @@ -226,10 +226,16 @@ void kshark_filter_add_id(struct kshark_context *kshark_ctx, void kshark_filter_clear(struct kshark_context *kshark_ctx, int filter_id); +bool kshark_filter_is_set(struct kshark_context *kshark_ctx); + void kshark_filter_entries(struct kshark_context *kshark_ctx, struct kshark_entry **data, size_t n_entries); +void kshark_clear_all_filters(struct kshark_context *kshark_ctx, + struct kshark_entry **data, + size_t n_entries); + /** Search failed identifiers. */ enum kshark_search_failed { /** All entries have timestamps greater timestamps. */