All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org,
	"Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Subject: [RFC PATCH 3/4] libtracefs: Add new 'hist' APIs
Date: Fri, 10 Sep 2021 19:38:56 +0300	[thread overview]
Message-ID: <20210910163857.324696-4-y.karadz@gmail.com> (raw)
In-Reply-To: <20210910163857.324696-1-y.karadz@gmail.com>

The new APIs will be valuable in a number of different scenarios.
For example if the user wants to implement a function that does
the readout of a histogram, the only argument that will have to
be passed to this function is the histogram descriptor. The same
applies for the case when the user wants to print an adequate
error message in a case of a failure.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 include/tracefs.h  |  4 ++++
 src/tracefs-hist.c | 20 ++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/include/tracefs.h b/include/tracefs.h
index c3fa1d6..255be9b 100644
--- a/include/tracefs.h
+++ b/include/tracefs.h
@@ -299,6 +299,10 @@ struct tracefs_hist *
 tracefs_hist_alloc(struct tracefs_instance * instance,
 		   const char *system, const char *event,
 		   struct tracefs_hist_axis *axes);
+const char *tracefs_get_hist_name(struct tracefs_hist *hist);
+const char *tracefs_get_hist_event(struct tracefs_hist *hist);
+const char *tracefs_get_hist_system(struct tracefs_hist *hist);
+struct tracefs_instance *tracefs_get_hist_instance(struct tracefs_hist *hist);
 int tracefs_hist_add_key(struct tracefs_hist *hist, const char *key,
 			 enum tracefs_hist_key_type type);
 int tracefs_hist_add_value(struct tracefs_hist *hist, const char *value);
diff --git a/src/tracefs-hist.c b/src/tracefs-hist.c
index 2ea90d9..175b627 100644
--- a/src/tracefs-hist.c
+++ b/src/tracefs-hist.c
@@ -34,6 +34,26 @@ struct tracefs_hist {
 	int			size;
 };
 
+const char *tracefs_get_hist_name(struct tracefs_hist *hist)
+{
+	return hist ? hist->name : NULL;
+}
+
+struct tracefs_instance *tracefs_get_hist_instance(struct tracefs_hist *hist)
+{
+	return hist ? hist->instance : NULL;
+}
+
+const char *tracefs_get_hist_event(struct tracefs_hist *hist)
+{
+	return hist ? hist->event : NULL;
+}
+
+const char *tracefs_get_hist_system(struct tracefs_hist *hist)
+{
+	return hist ? hist->system : NULL;
+}
+
 enum tracefs_hist_command {
 	HIST_CMD_NONE = 0,
 	HIST_CMD_PAUSE,
-- 
2.30.2


  parent reply	other threads:[~2021-09-10 16:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10 16:38 [RFC PATCH 0/4] Modifications of some 'hist' APIs Yordan Karadzhov (VMware)
2021-09-10 16:38 ` [RFC PATCH 1/4] libtracefs: Add new constructors for histograms Yordan Karadzhov (VMware)
2021-09-10 16:38 ` [RFC PATCH 2/4] libtracefs: Transform tracefs_hist_add_sort_key() Yordan Karadzhov (VMware)
2021-09-10 20:01   ` Steven Rostedt
2021-09-13 12:26     ` Yordan Karadzhov
2021-09-13 17:56       ` Steven Rostedt
2021-09-10 20:04   ` Steven Rostedt
2021-09-13 12:28     ` Yordan Karadzhov
2021-09-10 16:38 ` Yordan Karadzhov (VMware) [this message]
2021-09-10 16:38 ` [RFC PATCH 4/4] libtracefs: Remove tracefs_hist_add_key() Yordan Karadzhov (VMware)

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=20210910163857.324696-4-y.karadz@gmail.com \
    --to=y.karadz@gmail.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 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.