All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yordan Karadzhov <ykaradzhov@vmware.com>
To: "rostedt@goodmis.org" <rostedt@goodmis.org>
Cc: "linux-trace-devel@vger.kernel.org"
	<linux-trace-devel@vger.kernel.org>,
	"Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Subject: [PATCH v3 3/5] kernel-shark-qt: Add functions for fast clearing of the filters.
Date: Fri, 5 Oct 2018 18:33:27 +0000	[thread overview]
Message-ID: <20181005183241.27026-4-ykaradzhov@vmware.com> (raw)
In-Reply-To: <20181005183241.27026-1-ykaradzhov@vmware.com>

From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>

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) <y.karadz@gmail.com>
---
 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 d9d1929..56ae3ce 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. */
-- 
2.17.1

  parent reply	other threads:[~2018-10-06  1:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-05 18:33 [PATCH v3 0/5] Final preparation before adding the KernelShark GUI Yordan Karadzhov
2018-10-05 18:33 ` [PATCH v3 1/5] kernel-shark-qt: Add kshark_get_X_easy() functions Yordan Karadzhov
2018-10-05 19:20   ` Steven Rostedt
2018-10-05 18:33 ` [PATCH v3 2/5] kernel-shark-qt: Add kshark_convert_nano() function Yordan Karadzhov
2018-10-05 18:33 ` Yordan Karadzhov [this message]
2018-10-05 18:33 ` [PATCH v3 4/5] kernel-shark-qt: Rename the Cmake-generated header file Yordan Karadzhov
2018-10-05 18:33 ` [PATCH v3 5/5] kernel-shark-qt: Fix a bug in kshark_data_collection_alloc() Yordan Karadzhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181005183241.27026-4-ykaradzhov@vmware.com \
    --to=ykaradzhov@vmware.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=y.karadz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.