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>
Subject: [PATCH 1/2] kernel-shark-qt: Add a method for adding a new collection to a list
Date: Fri, 30 Nov 2018 15:42:36 +0000 [thread overview]
Message-ID: <20181130154211.4575-2-ykaradzhov@vmware.com> (raw)
In-Reply-To: <20181130154211.4575-1-ykaradzhov@vmware.com>
So far we have only one method that creates a new Data Collection.
It is kshark_register_data_collection(). The problem with this method
is that it automatically adds the new collection to the list of
collections, owned by the context of the session. This patch adds
a more generic method, which can be used to add new data collection
to a given list. The method will be used by the Sched event plugin,
which will keep its own list of collections, relevant only for the
plugin.
Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
kernel-shark-qt/src/libkshark-collection.c | 45 +++++++++++++++++++++-
kernel-shark-qt/src/libkshark.c | 1 +
kernel-shark-qt/src/libkshark.h | 9 +++++
3 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/kernel-shark-qt/src/libkshark-collection.c b/kernel-shark-qt/src/libkshark-collection.c
index 9838042..c70da1e 100644
--- a/kernel-shark-qt/src/libkshark-collection.c
+++ b/kernel-shark-qt/src/libkshark-collection.c
@@ -781,14 +781,55 @@ kshark_register_data_collection(struct kshark_context *kshark_ctx,
{
struct kshark_entry_collection *col;
+ col = kshark_add_collection_to_list(kshark_ctx,
+ &kshark_ctx->collections,
+ data, n_rows,
+ cond, val,
+ margin);
+
+ return col;
+}
+
+/**
+ * @brief Allocate and process data collection, defined with a given Matching
+ * condition function and value. Add this collection to a given list of
+ * collections.
+ *
+ * @param kshark_ctx: Input location for the session context pointer.
+ * @param col_list: Input location for the list of collections.
+ * @param data: Input location for the trace data.
+ * @param n_rows: The size of the inputted data.
+ * @param cond: Matching condition function for the collection to be
+ * registered.
+ * @param val: Matching condition value of for collection to be registered.
+ * @param margin: The size of the additional (margin) data which do not
+ * satisfy the matching condition, but is added at the
+ * beginning and at the end of each interval of the collection
+ * as well as at the beginning and at the end of data-set. If
+ * "0", no margin data is added.
+ *
+ * @returns Pointer to the registered Data collections on success, or NULL
+ * on failure.
+ */
+struct kshark_entry_collection *
+kshark_add_collection_to_list(struct kshark_context *kshark_ctx,
+ struct kshark_entry_collection **col_list,
+ struct kshark_entry **data,
+ size_t n_rows,
+ matching_condition_func cond,
+ int val,
+ size_t margin)
+{
+ struct kshark_entry_collection *col;
+
col = kshark_data_collection_alloc(kshark_ctx, data,
0, n_rows,
cond, val,
margin);
if (col) {
- col->next = kshark_ctx->collections;
- kshark_ctx->collections = col;
+ col->next = *col_list;
+ *col_list = col;
}
return col;
diff --git a/kernel-shark-qt/src/libkshark.c b/kernel-shark-qt/src/libkshark.c
index 86d3e58..598ea52 100644
--- a/kernel-shark-qt/src/libkshark.c
+++ b/kernel-shark-qt/src/libkshark.c
@@ -33,6 +33,7 @@ static bool kshark_default_context(struct kshark_context **context)
return false;
kshark_ctx->event_handlers = NULL;
+ kshark_ctx->collections = NULL;
kshark_ctx->plugins = NULL;
kshark_ctx->show_task_filter = tracecmd_filter_id_hash_alloc();
diff --git a/kernel-shark-qt/src/libkshark.h b/kernel-shark-qt/src/libkshark.h
index b3bd646..7d1edfc 100644
--- a/kernel-shark-qt/src/libkshark.h
+++ b/kernel-shark-qt/src/libkshark.h
@@ -412,6 +412,15 @@ struct kshark_entry_collection {
size_t size;
};
+struct kshark_entry_collection *
+kshark_add_collection_to_list(struct kshark_context *kshark_ctx,
+ struct kshark_entry_collection **col_list,
+ struct kshark_entry **data,
+ size_t n_rows,
+ matching_condition_func cond,
+ int val,
+ size_t margin);
+
struct kshark_entry_collection *
kshark_register_data_collection(struct kshark_context *kshark_ctx,
struct kshark_entry **data, size_t n_rows,
--
2.17.1
next prev parent reply other threads:[~2018-12-01 2:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-30 15:42 [PATCH 0/2] Make Sched event plugin use its own data collections Yordan Karadzhov
2018-11-30 15:42 ` Yordan Karadzhov [this message]
2018-11-30 15:42 ` [PATCH 2/2] kernel-shark-qt: " Yordan Karadzhov
2018-11-30 16:12 ` [PATCH 0/2] " Steven Rostedt
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=20181130154211.4575-2-ykaradzhov@vmware.com \
--to=ykaradzhov@vmware.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).