From: Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
To: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: Re: [PATCH v2 1/4] libtracefs: Add new constructors for histograms
Date: Fri, 24 Sep 2021 18:51:38 +0300 [thread overview]
Message-ID: <CAPpZLN7daWb2g_45CG3NzfKrEvK8NHNE+6k1NayYOL3u2b_EDw@mail.gmail.com> (raw)
In-Reply-To: <20210924095702.151826-2-y.karadz@gmail.com>
On Fri, Sep 24, 2021 at 12:59 PM Yordan Karadzhov (VMware)
<y.karadz@gmail.com> wrote:
>
> The current way to create an N-dimensional histogram is bit
> counterintuitive. We first have to call tracefs_hist_alloc()
> which is essentially a constructor of 1d histogram. Then we
> have to call tracefs_hist_add_key() N-1 times in order to
> increase the dimentions of the histogram. Here we transform
> tracefs_hist_alloc() into a constructor of N-dimensional
> histogram and we also add 2 helper constructors for 1d and
> 2d histograms.
>
> Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
> ---
> include/tracefs.h | 19 +++++++++--
> src/tracefs-hist.c | 84 ++++++++++++++++++++++++++++++++++++++--------
> 2 files changed, 87 insertions(+), 16 deletions(-)
>
> diff --git a/include/tracefs.h b/include/tracefs.h
> index 9d84777..5c4141e 100644
> --- a/include/tracefs.h
> +++ b/include/tracefs.h
> @@ -310,10 +310,25 @@ enum tracefs_compare {
> };
>
> void tracefs_hist_free(struct tracefs_hist *hist);
> +struct tracefs_hist *
> +tracefs_hist1d_alloc(struct tep_handle *tep,
> + const char *system, const char *event_name,
> + const char *key, enum tracefs_hist_key_type type);
> +struct tracefs_hist *
> +tracefs_hist2d_alloc(struct tep_handle *tep,
> + const char *system, const char *event_name,
> + const char *key1, enum tracefs_hist_key_type type1,
> + const char *key2, enum tracefs_hist_key_type type2);
> +
> +struct tracefs_hist_axis {
> + const char *key;
> + enum tracefs_hist_key_type type;
> +};
> +
> struct tracefs_hist *
> tracefs_hist_alloc(struct tep_handle *tep,
For consistency with the newly added "alloc" APIs, this should be
renamed. The dimensions of the histogram are part of the name, this
one is for N dimensions:
tracefs_hist_alloc_1d()
tracefs_hist_alloc_2d()
tracefs_hist_alloc_nd()
or something like that.
> - const char *system, const char *event,
> - const char *key, enum tracefs_hist_key_type type);
> + const char *system, const char *event_name,
> + struct tracefs_hist_axis *axes);
> 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 c112b68..ea12204 100644
> --- a/src/tracefs-hist.c
> +++ b/src/tracefs-hist.c
> @@ -189,7 +189,7 @@ void tracefs_hist_free(struct tracefs_hist *hist)
> }
[...]
--
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center
next prev parent reply other threads:[~2021-09-24 15:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-24 9:56 [PATCH v2 0/4] Modifications of some 'hist' APIs Yordan Karadzhov (VMware)
2021-09-24 9:56 ` [PATCH v2 1/4] libtracefs: Add new constructors for histograms Yordan Karadzhov (VMware)
2021-09-24 15:51 ` Tzvetomir Stoyanov [this message]
2021-09-24 15:54 ` Steven Rostedt
2021-09-24 16:53 ` Yordan Karadzhov
2021-09-24 9:57 ` [PATCH v2 2/4] libtracefs: Transform tracefs_hist_add_sort_key() Yordan Karadzhov (VMware)
2021-09-24 15:51 ` Tzvetomir Stoyanov
2021-09-24 16:56 ` Yordan Karadzhov
2021-11-10 22:43 ` Steven Rostedt
2021-09-24 9:57 ` [PATCH v2 3/4] libtracefs: Add new 'hist' APIs Yordan Karadzhov (VMware)
2021-09-24 9:57 ` [PATCH v2 4/4] libtracefs: Update 'hist' documentation Yordan Karadzhov (VMware)
2021-10-11 13:55 ` [RFC] Modifications of some 'hist' APIs Yordan Karadzhov
2021-10-13 2:14 ` 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=CAPpZLN7daWb2g_45CG3NzfKrEvK8NHNE+6k1NayYOL3u2b_EDw@mail.gmail.com \
--to=tz.stoyanov@gmail.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 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).